You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Dirk.vanGulik" <Di...@jrc.it> on 1996/06/06 07:35:59 UTC
set_flag and memory
a/ Would it be an idea to augment set_string_slot() with
char *set_flag_slot (cmd_parms *cmd, char *struct_ptr, int arg) {
int offset = (int)cmd->info;
(int)*(char **)(struct_ptr + offset) = arg;
return NULL;
}
And add some memory check for set_string_slot();
char *set_string_slot (cmd_parms *cmd, char *struct_ptr, char *arg) {
int offset = (int)cmd->info;
*(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg);
if (! ( *(char **)(struct_ptr + offset)))
return "Could not claim enough memory for Cookie Access Control";
return NULL;
}
The patch below does this.
Dw.
diff -c3 http_config.c ../src_org/http_config.c
*** http_config.c Thu Jun 6 07:34:18 1996
--- ../src_org/http_config.c Fri May 24 18:26:58 1996
***************
*** 508,520 ****
/* This one's pretty generic... */
int offset = (int)cmd->info;
! if (!(*(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg)))
! return "Could not claim memory in set_string_slot";
! return NULL;
! }
!
! char *set_flag_slot (cmd_parms *cmd, char *struct_ptr, int arg) {
! (int)*(char **)(struct_ptr + ((int)cmd->info)) = arg;
return NULL;
}
--- 508,514 ----
/* This one's pretty generic... */
int offset = (int)cmd->info;
! *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg);
return NULL;
}