[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.
This commit is contained in:
hare@suse.de 2004-03-31 22:56:45 -08:00 committed by Greg KH
parent 0bcdc8498c
commit 0536819cca

View File

@ -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);