]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix potential NULL ptr deref in fr_dlist_insert_head
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 May 2017 22:15:56 +0000 (18:15 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 May 2017 22:15:56 +0000 (18:15 -0400)
src/lib/io/time.h

index a8d04082be8101b0614fcc63ddb82148cfd3e857..05431fb785ebb104ebd2820ef089f66533eb5011 100644 (file)
@@ -86,7 +86,7 @@ static inline void fr_dlist_insert_head(fr_dlist_t *head, fr_dlist_t *entry)
 {
        entry->prev = head;
        entry->next = head->next;
-       head->next->prev = entry;
+       if (head->next) head->next->prev = entry; /* Head may be the only node in the list */
        head->next = entry;
 }