[asterisk-commits] alecdavis: trunk r253490 - /trunk/main/astobj2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 19 02:37:05 CDT 2010
Author: alecdavis
Date: Fri Mar 19 02:37:00 2010
New Revision: 253490
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253490
Log:
prevent segfault if bad magic number is encountered.
internal_ao2_ref uses INTERNAL_OBJ which mzy report 'bad magic number', but
internal_ao2_ref continues on, causing segfault.
Although AO2_MAGIC number is checked by INTERNAL_OBJ before internal_ao2_ref is
called, A02_MAGIC is being destroyed (or a wrong pointer) by the time
internal_ao2_ref uses INTERNAL_OBJ.
internal_ao2_ref now returns -1 if INTERNAL_OBJ encouters a bad magic number.
(issue #17037)
Reported by: alecdavis
Patches:
bug17037.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis
Modified:
trunk/main/astobj2.c
Modified: trunk/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/astobj2.c?view=diff&rev=253490&r1=253489&r2=253490
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Fri Mar 19 02:37:00 2010
@@ -261,6 +261,9 @@
struct astobj2 *obj = INTERNAL_OBJ(user_data);
int current_value;
int ret;
+
+ if (obj == NULL)
+ return -1;
/* if delta is 0, just return the refcount */
if (delta == 0)
@@ -499,7 +502,7 @@
struct bucket_list *p;
struct astobj2 *obj = INTERNAL_OBJ(user_data);
- if (!obj)
+ if (obj == NULL)
return NULL;
if (INTERNAL_OBJ(c) == NULL)
More information about the asterisk-commits
mailing list