projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix incorrect overflow check for allocation in fmemopen
[musl]
/
src
/
stdio
/
fmemopen.c
diff --git
a/src/stdio/fmemopen.c
b/src/stdio/fmemopen.c
index
7c193a5
..
2ce43d3
100644
(file)
--- a/
src/stdio/fmemopen.c
+++ b/
src/stdio/fmemopen.c
@@
-81,7
+81,7
@@
FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode)
return 0;
}
return 0;
}
- if (!buf && size >
SIZE_MAX-sizeof(FILE)-BUFSIZ-UNGET
) {
+ if (!buf && size >
PTRDIFF_MAX
) {
errno = ENOMEM;
return 0;
}
errno = ENOMEM;
return 0;
}