* 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>
* 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;
(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++;
}