Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Ilia Shipitsin <chipitsine@gmail.com>
To: wireguard@lists.zx2c4.com
Cc: Ilia Shipitsin <chipitsine@gmail.com>
Subject: [PATCH 1/1] src/config.c: handle strdup failure
Date: Tue,  9 Jul 2024 11:06:46 +0200	[thread overview]
Message-ID: <20240709090728.872-2-chipitsine@gmail.com> (raw)
In-Reply-To: <20240709090728.872-1-chipitsine@gmail.com>

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


      reply	other threads:[~2024-11-18 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09  9:06 [PATCH 0/1] handle potential " Ilia Shipitsin
2024-07-09  9:06 ` Ilia Shipitsin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240709090728.872-2-chipitsine@gmail.com \
    --to=chipitsine@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).