[Initng-svn] r3686 - initng/trunk/src

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Apr 5 14:24:58 CEST 2006


Author: jimmy
Date: Wed Apr  5 14:24:57 2006
New Revision: 3686

Modified:
   initng/trunk/src/initng_struct_data.c
Log:
Probith segfault if list is empty.


Modified: initng/trunk/src/initng_struct_data.c
==============================================================================
--- initng/trunk/src/initng_struct_data.c	(original)
+++ initng/trunk/src/initng_struct_data.c	Wed Apr  5 14:24:57 2006
@@ -64,8 +64,8 @@
                        s_data * last)
 {
     assert(head);
-    struct list_head *place;
-    s_data *current;
+    struct list_head *place = NULL;
+    s_data *current = NULL;
 
     RETURN_TYPE_CHECK(NULL);
 
@@ -98,11 +98,13 @@
     if(head->data_request && (*head->data_request)(head)==FALSE)
 	return (NULL);	
 
-    /* put place on the initial */
-    place = head->head.list.prev;
+    /* Make sure the list is not empty */
+    if(!list_empty(&head->head.list))
+	/* put place on the initial */
+	place = head->head.list.prev;
 
     /* as long as we dont stand on the header */
-    while (place != &head->head.list)
+    while (place && place != &head->head.list)
     {
         /* get the entry */
         current = list_entry(place, s_data, list);


More information about the Initng-svn mailing list