From: Derrick Brashear Date: Fri, 25 Sep 2009 07:15:40 +0000 (-0400) Subject: viced cap fetchdata len to avoid negative X-Git-Tag: openafs-stable-1_4_12pre1~124 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=dcb60b82fa2e216d02587fe349a4405146661c93;p=packages%2Fo%2Fopenafs.git viced cap fetchdata len to avoid negative when trying to read from a short or zero length file, it's possible for sanity checking to knock the length below zero. set a floor at zero. Reviewed-on: http://gerrit.openafs.org/494 Reviewed-by: Jeffrey Altman Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear (cherry picked from commit 529d487d65d8561f5d0a43a4dc71f72b86efd975) Reviewed-on: http://gerrit.openafs.org/500 --- diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index bf1adc55b..f9080527b 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -7087,8 +7087,9 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, Len = 0; } - if (Pos + Len > tlen) - Len = tlen - Pos; /* get length we should send */ + if (Pos + Len > tlen) /* get length we should send */ + Len = ((tlen - Pos) < 0) ? 0 : tlen - Pos; + (void)FDH_SEEK(fdP, Pos, 0); { afs_int32 high, low;