* lib/commonio.c: Make sure there are no NULL pointer dereference.

This commit is contained in:
nekral-guest 2010-08-20 20:34:44 +00:00
parent 07e67e1350
commit 22294bfac8
2 changed files with 10 additions and 2 deletions

View File

@ -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> 2010-08-20 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/remove_tree.c: Ignore snprintf return value. * libmisc/remove_tree.c: Ignore snprintf return value.

View File

@ -713,6 +713,7 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
for (ptr = db->head; for (ptr = db->head;
(NULL != ptr) (NULL != ptr)
#if KEEP_NIS_AT_END #if KEEP_NIS_AT_END
&& (NULL != ptr->line)
&& ('+' != ptr->line[0]) && ('+' != ptr->line[0])
#endif #endif
; ;
@ -720,7 +721,7 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
n++; n++;
} }
#if KEEP_NIS_AT_END #if KEEP_NIS_AT_END
if (NULL != ptr) { if ((NULL != ptr) && (NULL != ptr->line)) {
nis = ptr; nis = ptr;
} }
#endif #endif
@ -741,7 +742,10 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
#else #else
NULL != ptr; NULL != ptr;
#endif #endif
ptr = ptr->next) { /*@ -nullderef @*/
ptr = ptr->next
/*@ +nullderef @*/
) {
entries[n] = ptr; entries[n] = ptr;
n++; n++;
} }