From: Baptiste Daroussin Date: Mon, 24 Oct 2022 12:53:18 +0000 (+0200) Subject: Replace malloc+strcpy with strdup() X-Git-Tag: RELEASE_1_4_0a1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd063dbe93551e99fa6ef77fd313a05635b9692f;p=thirdparty%2Fmlmmj.git Replace malloc+strcpy with strdup() --- diff --git a/src/find_email_adr.c b/src/find_email_adr.c index 6eed55c5..b77e425d 100644 --- a/src/find_email_adr.c +++ b/src/find_email_adr.c @@ -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) {