summaryrefslogtreecommitdiff
path: root/main/http.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2012-07-31 20:21:43 +0000
committerKinsey Moore <kmoore@digium.com>2012-07-31 20:21:43 +0000
commit9b16c8b0f6c3b6310e303411421bfcb16b26c3c4 (patch)
tree273c31a834a21bd2239ec6b83cd35c602ea25d26 /main/http.c
parent6c23a60f802e7708389b1a6463a40dc0500512bd (diff)
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
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/http.c b/main/http.c
index 5bbeca33e..2df8e9c26 100644
--- a/main/http.c
+++ b/main/http.c
@@ -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);