Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102949624
D33903.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
594 B
Referenced Files
None
Subscribers
None
D33903.diff
View Options
diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c
--- a/lib/libc/stdio/fread.c
+++ b/lib/libc/stdio/fread.c
@@ -129,11 +129,13 @@
}
while (resid > (r = fp->_r)) {
- (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
- fp->_p += r;
- /* fp->_r = 0 ... done in __srefill */
- p += r;
- resid -= r;
+ if (r != 0) {
+ (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
+ fp->_p += r;
+ /* fp->_r = 0 ... done in __srefill */
+ p += r;
+ resid -= r;
+ }
if (__srefill(fp)) {
/* no more input: return partial result */
return ((total - resid) / size);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 2:41 AM (22 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14728337
Default Alt Text
D33903.diff (594 B)
Attached To
Mode
D33903: Fix undefined behavior in fread()
Attached
Detach File
Event Timeline
Log In to Comment