summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-02-16 16:50:42 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-02-16 16:50:42 +0000
commit0897ff116e062f5bc73cb30ca4c06dc920183870 (patch)
treeb212ae356fe0db6045be514c478f4544c38df65e /usr.sbin
parentd9b3f848951b2cd0b0c1043ab7d34caca8c61936 (diff)
Prevent double free by copying the URI string from struct tal to the repo.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rpki-client/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index 9e5d64beb9e..3543ad61fdc 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.99 2021/02/16 08:52:00 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.100 2021/02/16 16:50:41 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -351,7 +351,8 @@ ta_lookup(const struct tal *tal)
for (i = 0, j = 0; i < tal->urisz && j < 2; i++) {
if (strncasecmp(tal->uri[i], "rsync://", 8) != 0)
continue; /* ignore non rsync URI for now */
- rp->uris[j++] = tal->uri[i];
+ if ((rp->uris[j++] = strdup(tal->uri[i])) == NULL)
+ err(1, "strdup");
}
if (j == 0)
errx(1, "TAL file has no rsync:// URI");