]> granicus.if.org Git - shadow/commitdiff
* lib/commonio.c: Make sure there are no NULL pointer dereference.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 20 Aug 2010 20:34:44 +0000 (20:34 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 20 Aug 2010 20:34:44 +0000 (20:34 +0000)
ChangeLog
lib/commonio.c

index 5e68631b107220f542e019c4c6e7c83db24d43db..31e2fee7618a384e5e1ea0e6414cce691bc2f7e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-20  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/commonio.c: Make sure there are no NULL pointer dereference.
+
 2010-08-20  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/remove_tree.c: Ignore snprintf return value.
index 38f4d85abbf110659ecd15a449533c8d801833b2..4eae17d182d6b76d7a53fadb69322a1d8478c4cb 100644 (file)
@@ -713,6 +713,7 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
        for (ptr = db->head;
                (NULL != ptr)
 #if KEEP_NIS_AT_END
+            && (NULL != ptr->line)
             && ('+' != ptr->line[0])
 #endif
             ;
@@ -720,7 +721,7 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
                n++;
        }
 #if KEEP_NIS_AT_END
-       if (NULL != ptr) {
+       if ((NULL != ptr) && (NULL != ptr->line)) {
                nis = ptr;
        }
 #endif
@@ -741,7 +742,10 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
 #else
             NULL != ptr;
 #endif
-            ptr = ptr->next) {
+/*@ -nullderef @*/
+            ptr = ptr->next
+/*@ +nullderef @*/
+           ) {
                entries[n] = ptr;
                n++;
        }