projects
/
qemu-gpiodev
/
libfuse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
27a112e
)
add_arg(): check for overflow
author
Nikolaus Rath
<Nikolaus@rath.org>
Fri, 11 May 2018 13:56:45 +0000
(14:56 +0100)
committer
Nikolaus Rath
<Nikolaus@rath.org>
Fri, 11 May 2018 14:01:04 +0000
(15:01 +0100)
Fixes: #222.
util/mount.fuse.c
patch
|
blob
|
history
diff --git
a/util/mount.fuse.c
b/util/mount.fuse.c
index 3f498dbb8707b936643f6a5cffa002ff3abe356a..169fe537f1f167a55258bb0d1c74c207131a1bb6 100644
(file)
--- a/
util/mount.fuse.c
+++ b/
util/mount.fuse.c
@@
-13,6
+13,7
@@
#include <string.h>
#include <unistd.h>
#include <errno.h>
+#include <stdint.h>
static char *progname;
@@
-40,6
+41,10
@@
static void add_arg(char **cmdp, const char *opt)
{
size_t optlen = strlen(opt);
size_t cmdlen = *cmdp ? strlen(*cmdp) : 0;
+ if (optlen >= (SIZE_MAX - cmdlen - 4)/4) {
+ fprintf(stderr, "%s: argument too long\n", progname);
+ exit(1);
+ }
char *cmd = xrealloc(*cmdp, cmdlen + optlen * 4 + 4);
char *s;
s = cmd + cmdlen;