[PATCH 1/1] src/config.c: handle strdup failure

Ilia Shipitsin chipitsine at gmail.com
Tue Jul 9 09:07:48 UTC 2024


Signed-off-by: Ilia Shipitsin <chipitsine at gmail.com>
---
 src/config.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/config.c b/src/config.c
index 81ccb47..f78e076 100644
--- a/src/config.c
+++ b/src/config.c
@@ -357,6 +357,12 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **la
 		char *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));
-- 
2.43.0.windows.1



More information about the WireGuard mailing list