]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Replace malloc+strcpy with strdup()
authorBaptiste Daroussin <bapt@FreeBSD.org>
Mon, 24 Oct 2022 12:53:18 +0000 (14:53 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Mon, 24 Oct 2022 12:53:18 +0000 (14:53 +0200)
src/find_email_adr.c

index 6eed55c58844e12c46bfe531122309f0911bd6e1..b77e425d5d174cead16b8c188d642dde262f6e25 100644 (file)
@@ -85,13 +85,12 @@ static char *skin(char *name)
                return (NULL);
 
        /* We assume that length(input) <= length(output) */
-       nbuf = xmalloc(strlen(name) + 1);
 
        if (strchr(name, '(') == NULL && strchr(name, '<') == NULL
            && strchr(name, ' ') == NULL) {
-               strcpy(nbuf, name);
-               return (nbuf);
+               return (xstrdup(name));
        }
+       nbuf = xmalloc(strlen(name) +1);
 
        gotlt = 0;
        lastsp = 0;
@@ -188,8 +187,7 @@ struct email_container *find_email_adr(const char *str,
        char *p;
        char *s;
 
-       s = (char *)xmalloc(strlen(str) + 1);
-       strcpy(s, str);
+       s = xstrdup(str);
 
        p = s;
        while(p) {