LVM2/daemons/common daemon-shared.c
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2012-01-16 05:09:16
Modified files:
daemons/common : daemon-shared.c
Log message:
Fix a boundary condition in read_buffer in daemon-shared.c.
daemons/common/daemon-shared.c +6 -7
@@ -30,20 +30,19 @@if (result <0 && errno !=EAGAIN && errno !=EWOULDBLOCK ) goto fail; +if ((!strncmp ((*buffer) + bytes -4 ,"\n##\n" ,4 ))) { + *(*buffer + bytes -4 ) =0 ; +break ;/* success, we have the full message now */ + } +if (bytes == buffersize) { buffersize +=1024 ;if (!(new =realloc (*buffer, buffersize +1 ))) goto fail; *buffer = new; - }else { - (*buffer)[bytes] =0 ; -if ((end =strstr ((*buffer) + bytes -4 ,"\n##\n" ))) { - *end =0 ; -break ;/* success, we have the full message now */ - } -/* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */ } +/* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */ }return 1 ; fail: