diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-20 01:25:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:18:51 -0500 |
commit | cab256d72a91f59432e28e9623c10384d9ca2b5e (patch) | |
tree | 56e8a978cf13a985e7a114eec879b548833f56d1 /source/printing | |
parent | e99cedfb0cabe3863797c8bd4594ee0826022d2e (diff) | |
download | samba-cab256d72a91f59432e28e9623c10384d9ca2b5e.tar.gz samba-cab256d72a91f59432e28e9623c10384d9ca2b5e.tar.xz samba-cab256d72a91f59432e28e9623c10384d9ca2b5e.zip |
r16392: Klockwork #1168. Protect against null deref.
Jeremy.
Diffstat (limited to 'source/printing')
-rw-r--r-- | source/printing/printing_db.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/printing/printing_db.c b/source/printing/printing_db.c index adea10dfa69..c62409c8908 100644 --- a/source/printing/printing_db.c +++ b/source/printing/printing_db.c @@ -55,7 +55,9 @@ struct tdb_print_db *get_print_db_byname(const char *printername) /* Not found. */ if (num_open >= MAX_PRINT_DBS_OPEN) { /* Try and recycle the last entry. */ - DLIST_PROMOTE(print_db_head, last_entry); + if (print_db_head && last_entry) { + DLIST_PROMOTE(print_db_head, last_entry); + } for (p = print_db_head; p; p = p->next) { if (p->ref_count) @@ -72,7 +74,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername) memset(p->printer_name, '\0', sizeof(p->printer_name)); break; } - if (p) { + if (p && print_db_head) { DLIST_PROMOTE(print_db_head, p); p = print_db_head; } |