svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Tue Oct 31 22:46:09 UTC 2006


Author: vda
Date: 2006-10-31 14:46:08 -0800 (Tue, 31 Oct 2006)
New Revision: 16480

Log:
reads: fix bug 1078


Modified:
   trunk/busybox/libbb/read.c


Changeset:
Modified: trunk/busybox/libbb/read.c
===================================================================
--- trunk/busybox/libbb/read.c	2006-10-31 18:41:29 UTC (rev 16479)
+++ trunk/busybox/libbb/read.c	2006-10-31 22:46:08 UTC (rev 16480)
@@ -86,7 +86,8 @@
 	if (p) {
 		off_t offset;
 		*p++ = '\0';
-		offset = (p-buffer) - size;
+		// avoid incorrect (unsigned) widening
+		offset = (off_t)(p-buffer) - (off_t)size;
 		// set fd position the right after the \n
 		if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1)
 			return NULL;




More information about the busybox-cvs mailing list