From: Jason A. Donenfeld Date: Wed, 19 Apr 2017 14:51:24 +0000 (+0200) Subject: wg: check for malloc failure X-Git-Tag: v1.0.20191226~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a967c63a7524b3a86e9d2a6123e4d4e25d2860a;p=thirdparty%2Fwireguard-tools.git wg: check for malloc failure Signed-off-by: Jason A. Donenfeld --- diff --git a/src/config.c b/src/config.c index 8f75804..be15870 100644 --- a/src/config.c +++ b/src/config.c @@ -153,6 +153,10 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value) .ai_socktype = SOCK_DGRAM, .ai_protocol = IPPROTO_UDP }; + if (!mutable) { + perror("strdup"); + return false; + } if (!strlen(value)) { free(mutable); fprintf(stderr, "Unable to parse empty endpoint\n");