Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102956183
D31383.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
628 B
Referenced Files
None
Subscribers
None
D31383.diff
View Options
Index: lib/libc/stdio/fread.c
===================================================================
--- lib/libc/stdio/fread.c
+++ lib/libc/stdio/fread.c
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
+#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
@@ -129,8 +130,12 @@
}
while (resid > (r = fp->_r)) {
- (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
- fp->_p += r;
+ if (fp->_p) {
+ (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
+ fp->_p += r;
+ } else {
+ assert(r == 0);
+ }
/* fp->_r = 0 ... done in __srefill */
p += r;
resid -= r;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 4:26 AM (21 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14730208
Default Alt Text
D31383.diff (628 B)
Attached To
Mode
D31383: Fix undefined pointer arithmetic in fread()
Attached
Detach File
Event Timeline
Log In to Comment