mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's __builtin_alloca() to avoid BSD semantics and removes all NULL checks on memory allocated via ast_alloca() and ast_strdupa(). (closes issue ASTERISK-20125) Review: https://reviewboard.asterisk.org/r/2032/ Patch-by: Walter Doekes (wdoekes) ........ Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -251,7 +251,7 @@ static int static_callback(struct ast_tcptls_session_instance *ser,
|
||||
goto out403;
|
||||
}
|
||||
|
||||
path = alloca(len);
|
||||
path = ast_alloca(len);
|
||||
sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
|
||||
if (stat(path, &st)) {
|
||||
goto out404;
|
||||
@@ -624,9 +624,7 @@ struct ast_variable *ast_http_get_post_vars(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(buf = alloca(content_length))) {
|
||||
return NULL;
|
||||
}
|
||||
buf = ast_alloca(content_length);
|
||||
if (!fgets(buf, content_length, ser->f)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -767,7 +765,7 @@ cleanup:
|
||||
static HOOK_T ssl_write(void *cookie, const char *buf, LEN_T len)
|
||||
{
|
||||
#if 0
|
||||
char *s = alloca(len+1);
|
||||
char *s = ast_alloca(len+1);
|
||||
strncpy(s, buf, len);
|
||||
s[len] = '\0';
|
||||
ast_verbose("ssl write size %d <%s>\n", (int)len, s);
|
||||
|
Reference in New Issue
Block a user