handle potential strdup failure
cover handle potential strdup failure
if allocation fails, strdup returns NULL.
Ilia Shipitsin (1):
src/config.c: handle strdup failure
src/config.c | 6 ++++++ 1 file changed, 6 insertions(+)
Signature · 1 line
2.43.0.windows.1
PATCH 1/1 src/config.c: handle strdup failure
Signed-off-by Ilia Shipitsin <[email protected]>
--- src/config.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/config.c +6 -0
@@ -357,6 +357,12 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **lachar *end, *ip; saved_entry =strdup (mask); +if (!saved_entry) { +perror ("strdup" ); +free (mutable); +return false; + } + ip =strsep (&mask,"/" ); new_allowedip =calloc (1 ,sizeof (*new_allowedip));
Signature · 1 line
2.43.0.windows.1
Jason A. Donenfeld
AppliedRe: [PATCH 1/1] src/config.c: handle strdup failure
Applied, thanks for the patch.