From: claudio Date: Tue, 16 Feb 2021 16:50:41 +0000 (+0000) Subject: Prevent double free by copying the URI string from struct tal to the repo. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=859c9b4227f6a778865d50a46704eea93c0c2945;p=openbsd Prevent double free by copying the URI string from struct tal to the repo. --- 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 * @@ -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");