diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-01-09 15:15:04 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-01-09 15:15:15 +0100 |
commit | 14638b10ae873478cac6c1fbc233e024242db10a (patch) | |
tree | 3d4237da2bb708e568b1d154fa99315b0538c2a3 /app/tools | |
parent | 426fa7d50b632ae41216cfdf9eded42eafa48ea5 (diff) |
tools: try not to overflow
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/tools')
-rw-r--r-- | app/tools/wg-quick.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/tools/wg-quick.c b/app/tools/wg-quick.c index e424caad..f3f552fd 100644 --- a/app/tools/wg-quick.c +++ b/app/tools/wg-quick.c @@ -286,6 +286,8 @@ static void up_if(unsigned int *netid, const char *iface) static void set_dnses(unsigned int netid, const char *dnses) { size_t len = strlen(dnses); + if (len > (1<<16)) + return; _cleanup_free_ char *mutable = xstrdup(dnses); _cleanup_free_ char *arglist = xmalloc(len * 4 + 1); _cleanup_free_ char *arg = xmalloc(len + 4); @@ -586,6 +588,8 @@ static void parse_options(char **iface, char **config, unsigned int *mtu, char * while (getline(&line, &n, file) >= 0) { size_t len = strlen(line), j = 0; + if (len > (1<<16)) + return; _cleanup_free_ char *clean = xmalloc(len + 1); for (size_t i = 0; i < len; ++i) { |