[asterisk-commits] seanbright: branch 1.8 r373131 - /branches/1.8/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 18 15:12:45 CDT 2012


Author: seanbright
Date: Tue Sep 18 15:12:41 2012
New Revision: 373131

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373131
Log:
Don't crash when passing a NULL message to __astman_get_header.

Before this commit, __astman_get_header would blindly dereference the passed in
'struct message *' to traverse the header list.  There are cases, however, such
as '*CLI> sip qualify peer foo' where the message pointer is NULL, so we need
to check for that.

Modified:
    branches/1.8/main/manager.c

Modified: branches/1.8/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/manager.c?view=diff&rev=373131&r1=373130&r2=373131
==============================================================================
--- branches/1.8/main/manager.c (original)
+++ branches/1.8/main/manager.c Tue Sep 18 15:12:41 2012
@@ -1790,6 +1790,10 @@
 	int x, l = strlen(var);
 	const char *result = "";
 
+	if (!m) {
+		return result;
+	}
+
 	for (x = 0; x < m->hdrcount; x++) {
 		const char *h = m->headers[x];
 		if (!strncasecmp(var, h, l) && h[l] == ':') {




More information about the asterisk-commits mailing list