[asterisk-commits] mjordan: branch 1.8 r384118 - /branches/1.8/main/http.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 27 13:49:21 CDT 2013
Author: mjordan
Date: Wed Mar 27 13:49:17 2013
New Revision: 384118
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384118
Log:
Fix a file descriptor leak in off nominal path
While looking at the security vulnerability in ASTERISK-20967, Walter noticed
a file descriptor leak and some other issues in off nominal code paths. This
patch corrects them.
Note that this patch is not related to the vulnerability in ASTERISK-20967,
but the patch was placed on that issue.
(closes issue ASTERISK-20967)
Reported by: wdoekes
patches:
issueA20967_file_leak_and_unused_wkspace.patch uploaded by wdoekes (License 5674)
Modified:
branches/1.8/main/http.c
Modified: branches/1.8/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/http.c?view=diff&rev=384118&r1=384117&r2=384118
==============================================================================
--- branches/1.8/main/http.c (original)
+++ branches/1.8/main/http.c Wed Mar 27 13:49:17 2013
@@ -230,7 +230,7 @@
goto out403;
}
- /* Disallow any funny filenames at all */
+ /* Disallow any funny filenames at all (checking first character only??) */
if ((uri[0] < 33) || strchr("./|~@#$%^&*() \t", uri[0])) {
goto out403;
}
@@ -245,6 +245,7 @@
if (!(mtype = ast_http_ftype2mtype(ftype))) {
snprintf(wkspace, sizeof(wkspace), "text/%s", S_OR(ftype, "plain"));
+ mtype = wkspace;
}
/* Cap maximum length */
@@ -262,12 +263,12 @@
goto out404;
}
+ if (strstr(path, "/private/") && !astman_is_authed(ast_http_manid_from_vars(headers))) {
+ goto out403;
+ }
+
fd = open(path, O_RDONLY);
if (fd < 0) {
- goto out403;
- }
-
- if (strstr(path, "/private/") && !astman_is_authed(ast_http_manid_from_vars(headers))) {
goto out403;
}
@@ -290,6 +291,7 @@
}
if ( (http_header = ast_str_create(255)) == NULL) {
+ close(fd);
return -1;
}
More information about the asterisk-commits
mailing list