In tal_parse() use strndup() to create the tal descr instead of the more
complex malloc, memcpy version. Result is the same but the strndup version
is a lot nicer.

OK?
-- 
:wq Claudio

Index: tal.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/tal.c,v
retrieving revision 1.22
diff -u -p -r1.22 tal.c
--- tal.c       11 Oct 2020 12:39:25 -0000      1.22
+++ tal.c       3 Dec 2020 12:00:25 -0000
@@ -198,10 +198,8 @@ tal_parse(const char *fn, char *buf)
        dlen = strlen(d);
        if (strcasecmp(d + dlen - 4, ".tal") == 0)
                dlen -= 4;
-       if ((p->descr = malloc(dlen + 1)) == NULL)
+       if ((p->descr = strndup(d, dlen)) == NULL)
                err(1, NULL);
-       memcpy(p->descr, d, dlen);
-       p->descr[dlen] = '\0';
 
        return p;
 }

Reply via email to