* [PATCH 0/1] handle potential strdup failure
@ 2024-07-09 9:06 Ilia Shipitsin
2024-07-09 9:06 ` [PATCH 1/1] src/config.c: handle " Ilia Shipitsin
0 siblings, 1 reply; 2+ messages in thread
From: Ilia Shipitsin @ 2024-07-09 9:06 UTC (permalink / raw)
To: wireguard; +Cc: Ilia Shipitsin
if allocation fails, strdup returns NULL.
Ilia Shipitsin (1):
src/config.c: handle strdup failure
src/config.c | 6 ++++++
1 file changed, 6 insertions(+)
--
2.43.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] src/config.c: handle strdup failure
2024-07-09 9:06 [PATCH 0/1] handle potential strdup failure Ilia Shipitsin
@ 2024-07-09 9:06 ` Ilia Shipitsin
0 siblings, 0 replies; 2+ messages in thread
From: Ilia Shipitsin @ 2024-07-09 9:06 UTC (permalink / raw)
To: wireguard; +Cc: Ilia Shipitsin
Signed-off-by: Ilia Shipitsin <chipitsine@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-18 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-09 9:06 [PATCH 0/1] handle potential strdup failure Ilia Shipitsin
2024-07-09 9:06 ` [PATCH 1/1] src/config.c: handle " Ilia Shipitsin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).