projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4126b1f
)
reads: fix bug 1078
author
Denis Vlasenko
<vda.linux@googlemail.com>
Tue, 31 Oct 2006 22:46:08 +0000
(22:46 -0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Tue, 31 Oct 2006 22:46:08 +0000
(22:46 -0000)
libbb/read.c
patch
|
blob
|
history
diff --git
a/libbb/read.c
b/libbb/read.c
index 1c2945f454101f79853044e565b5c61b83a28e31..b3648b4d749fb64360e15d8f7623af46e010eeae 100644
(file)
--- a/
libbb/read.c
+++ b/
libbb/read.c
@@
-86,7
+86,8
@@
char *reads(int fd, char *buffer, size_t size)
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;