summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhare@suse.de <hare@suse.de>2004-03-31 22:56:45 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:13 -0700
commit0536819cca9468cf383807037dbaa5ad0d48b60f (patch)
treeac351b9d34efa2ee012499ceb2129d3e7b1ede13
parent0bcdc8498cdeaaef37444d38f39a19ff9557914d (diff)
[PATCH] fix SEGV in libsysfs/dlist.c
Hi all, Greg, libsysfs/dlist.c: _dlist_mark_move() is missing checks for empty lists and may (and indeed, does) crash when=20 called with empty dlists.
-rw-r--r--libsysfs/dlist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c
index 942eccb48c..b440d65bed 100644
--- a/libsysfs/dlist.c
+++ b/libsysfs/dlist.c
@@ -74,14 +74,14 @@ inline void *_dlist_mark_move(Dlist *list,int direction)
{
if(direction)
{
- if( list->marker->next!=NULL)
+ if( list->marker && list->marker->next!=NULL)
list->marker=list->marker->next;
else
return(NULL);
}
else
{
- if( list->marker->prev!=NULL)
+ if( list->marker && list->marker->prev!=NULL)
list->marker=list->marker->prev;
else
return(NULL);