Merge pull request #70 from t8m/master

Fix buffer overflow if NULL line is present in db.
This commit is contained in:
Serge Hallyn 2017-04-01 15:46:05 -05:00 committed by GitHub
commit 2f36da5201

View File

@ -751,16 +751,16 @@ 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])
&& ('-' != ptr->line[0]))
&& ((NULL == ptr->line)
|| (('+' != ptr->line[0])
&& ('-' != ptr->line[0])))
#endif
;
ptr = ptr->next) {
n++;
}
#if KEEP_NIS_AT_END
if ((NULL != ptr) && (NULL != ptr->line)) {
if (NULL != ptr) {
nis = ptr;
}
#endif