aboutsummaryrefslogtreecommitdiffstats
path: root/manager.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-04 00:16:33 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-04 00:16:33 +0000
commitcc92907551f78d3a67898974f50d3dcf5b9a3ec7 (patch)
treef8034972ee4ce1092504cc5adc0e3237de283ea3 /manager.c
parent012ceb12eddc29172df6615e64d2c2643128d57a (diff)
Bug 7472 - Change line terminator for header to be RFC-compliant
Also, check to ensure the memory allocation didn't fail. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@36892 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/manager.c b/manager.c
index 9ad15d993..d2c25ecce 100644
--- a/manager.c
+++ b/manager.c
@@ -2169,7 +2169,11 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co
if (!s) {
/* Create new session */
- s = calloc(1, sizeof(struct mansession));
+ s = ast_calloc(1, sizeof(struct mansession));
+ if (!s) {
+ *status = 500;
+ goto generic_callback_out;
+ }
memcpy(&s->sin, requestor, sizeof(s->sin));
s->fd = -1;
s->waiting_thread = AST_PTHREADT_NULL;
@@ -2203,7 +2207,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co
memset(&m, 0, sizeof(m));
if (s) {
char tmp[80];
- ast_build_string(&c, &len, "Content-type: text/%s\n", contenttype[format]);
+ ast_build_string(&c, &len, "Content-type: text/%s\r\n", contenttype[format]);
sprintf(tmp, "%08lx", s->managerid);
ast_build_string(&c, &len, "%s\r\n", ast_http_setcookie("mansession_id", tmp, httptimeout, cookie, sizeof(cookie)));
if (format == FORMAT_HTML)
@@ -2280,6 +2284,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co
if (blastaway)
destroy_session(s);
+generic_callback_out:
if (*status != 200)
return ast_http_error(500, "Server Error", NULL, "Internal Server Error (out of memory)\n");
return retval;