From: Ralph Corderoy Date: Tue, 18 Oct 2016 12:09:27 +0000 (+0100) Subject: Replace getcpy() with mh_xstrdup() where the string isn't NULL. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c8773dc680d5ec95ad5f862d44ce15124c95146a?ds=inline Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index bc93672a..ab9ddff2 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -149,7 +149,7 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize) mp->m_next = NULL; mp->m_text = getcpy (str); if (pers) - mp->m_pers = getcpy (pers); + mp->m_pers = mh_xstrdup(pers); if (mbox == NULL) { mp->m_type = BADHOST; @@ -157,19 +157,19 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize) mp->m_ingrp = ingrp; mp->m_gname = getcpy (grp); if (note) - mp->m_note = getcpy (note); + mp->m_note = mh_xstrdup(note); return mp; } if (host) { mp->m_mbox = getcpy (mbox); - mp->m_host = getcpy (host); + mp->m_host = mh_xstrdup(host); mp->m_type = strcasecmp (LocalName(0), mp->m_host) ? NETHOST : LOCALHOST; } else { if ((pp = strchr(mbox, '!'))) { *pp++ = '\0'; - mp->m_mbox = getcpy (pp); + mp->m_mbox = mh_xstrdup(pp); mp->m_host = getcpy (mbox); mp->m_type = UUCPHOST; } else { @@ -189,12 +189,12 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize) to support wild-card matching. */ if (route) - mp->m_path = getcpy (route); + mp->m_path = mh_xstrdup(route); mp->m_ingrp = ingrp; if (grp) - mp->m_gname = getcpy (grp); + mp->m_gname = mh_xstrdup(grp); if (note) - mp->m_note = getcpy (note); + mp->m_note = mh_xstrdup(note); return mp; } diff --git a/sbr/arglist.c b/sbr/arglist.c index 0edfc8b8..68a26a20 100644 --- a/sbr/arglist.c +++ b/sbr/arglist.c @@ -61,7 +61,7 @@ argsplit(char *command, char **file, int *argp) if (!space && !metachar) { argvarray[0] = getcpy(r1bindex(command, '/')); argvarray[1] = NULL; - *file = getcpy(command); + *file = mh_xstrdup(command); if (argp) *argp = 1; return argvarray; @@ -74,20 +74,20 @@ argsplit(char *command, char **file, int *argp) if (space && !metachar) { char **split; - p = getcpy(command); + p = mh_xstrdup(command); split = brkstring(p, " \t", NULL); if (split[0] == NULL) { adios(NULL, "Invalid blank command found"); } - argvarray[0] = getcpy(r1bindex(split[0], '/')); + argvarray[0] = mh_xstrdup(r1bindex(split[0], '/')); for (i = 1; split[i] != NULL; i++) { if (i > MAXARGS) { adios(NULL, "Command exceeded argument limit"); } - argvarray[i] = getcpy(split[i]); + argvarray[i] = mh_xstrdup(split[i]); } argvarray[i] = NULL; - *file = getcpy(split[0]); + *file = mh_xstrdup(split[0]); if (argp) *argp = i; free(p); @@ -113,7 +113,7 @@ argsplit(char *command, char **file, int *argp) *file = mh_xstrdup("/bin/sh"); argvarray[0] = mh_xstrdup("sh"); argvarray[1] = mh_xstrdup("-c"); - argvarray[2] = getcpy(command); + argvarray[2] = mh_xstrdup(command); argvarray[2] = add(" \"$@\"", argvarray[2]); argvarray[3] = mh_xstrdup("/bin/sh"); argvarray[4] = NULL; diff --git a/sbr/oauth.c b/sbr/oauth.c index 7977586c..2aedf82c 100755 --- a/sbr/oauth.c +++ b/sbr/oauth.c @@ -366,7 +366,7 @@ mh_oauth_get_err_string(mh_oauth_ctx *ctx) base = "unknown error"; } if (ctx->err_details == NULL) { - return ctx->err_formatted = getcpy(base); + return ctx->err_formatted = mh_xstrdup(base); } ctx->err_formatted = concat(base, ": ", ctx->err_details, NULL);