patch:libXt-1.0.8 fix possible NULL access

walter harms wharms at bfs.de
Fri Oct 1 06:13:43 PDT 2010


Hi List,
while testing a static checker, i got warnings about a possible NULL access.
looking into the code i found that GetClassActions() may return NULL
causing table->signature to ask for trouble.

re,
 wh



Honor that GetClassActions() may return NULL.

Signed-off-by: Walter <wharms at bfs.de>


--- libXt-1.0.8/src/TMaction.c.org      2010-09-29 20:37:48.000000000 +0200
+++ libXt-1.0.8/src/TMaction.c  2010-09-29 20:39:56.000000000 +0200
@@ -807,10 +807,12 @@
     if (*num_actions_return) {
        list = *actions_return = (XtActionList)
            __XtMalloc(*num_actions_return * sizeof(XtActionsRec));
-       table = GetClassActions(widget_class);
-       for (i= (*num_actions_return); --i >= 0; list++, table++) {
-           list->string = XrmQuarkToString(table->signature);
-           list->proc = table->proc;
+       table = GetClassActions(widget_class);
+       if (table != NULL ) {
+               for (i= (*num_actions_return); --i >= 0; list++, table++) {
+                       list->string = XrmQuarkToString(table->signature);
+                       list->proc = table->proc;
+               }
        }
     }
     UNLOCK_PROCESS;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TMaction.c.diff
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101001/b7c38537/attachment-0001.bin>


More information about the xorg-devel mailing list