chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
97569e1
)
strv: use realloc_multiply() to check for multiplication overflow
author
Michal Schmidt
<mschmidt@redhat.com>
Tue, 21 Oct 2014 12:36:03 +0000
(14:36 +0200)
committer
Michal Schmidt
<mschmidt@redhat.com>
Tue, 21 Oct 2014 12:36:03 +0000
(14:36 +0200)
This could overflow on 32bit, where size_t is the same as unsigned.
src/shared/strv.c
patch
|
blob
|
history
diff --git
a/src/shared/strv.c
b/src/shared/strv.c
index efa648df88c1a0857fb9a61c40661e2a69cdf3f6..00857e40a7a3b500865c9516a2bc69fd25a8432e 100644
(file)
--- a/
src/shared/strv.c
+++ b/
src/shared/strv.c
@@
-392,7
+392,7
@@
int strv_push(char ***l, char *value) {
if (m < n)
return -ENOMEM;
- c = realloc
(*l, sizeof(char*) * (size_t)
m);
+ c = realloc
_multiply(*l, sizeof(char*),
m);
if (!c)
return -ENOMEM;