From 9f8418e870a70c264eda1598f2d470e5428c216d Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 01/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/context_replace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/context_replace.c b/sbr/context_replace.c index 907acb35..6a270c0f 100644 --- a/sbr/context_replace.c +++ b/sbr/context_replace.c @@ -41,7 +41,7 @@ context_replace (char *key, char *value) admonish (NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value); if (np->n_field) free (np->n_field); - np->n_field = getcpy (value); + np->n_field = mh_xstrdup(value); ctxflags |= CTXMOD; } return; -- 2.56.1 From 75cb75e930551c2a611183d96b22ae225ff3113f Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 02/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/fmt_compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 4f60cebb..10d3e575 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -290,7 +290,7 @@ static struct colormap colortable[] = { /* Add new component to the hash table */ #define NEWCOMP(cm,name) do { \ NEW0(cm);\ - cm->c_name = getcpy(name);\ + cm->c_name = mh_xstrdup(name);\ cm->c_refcount++;\ ncomp++;\ i = CHASH(name);\ @@ -393,7 +393,7 @@ fmt_compile(char *fstring, struct format **fmt, int reset_comptable) size_t i; static int comptable_initialized = 0; - format_string = getcpy (fstring); + format_string = mh_xstrdup(fstring); usr_fstring = fstring; if (reset_comptable || !comptable_initialized) { -- 2.56.1 From 92dd7b914b878f2172b4d436e9643c4a0d24683b Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 03/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/getarguments.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/getarguments.c b/sbr/getarguments.c index 0f8834b7..e1b86388 100644 --- a/sbr/getarguments.c +++ b/sbr/getarguments.c @@ -20,7 +20,7 @@ getarguments (char *invo_name, int argc, char **argv, int check_context) * Check if profile/context specifies any arguments */ if (check_context && (cp = context_find (invo_name))) { - cp = getcpy (cp); /* make copy */ + cp = mh_xstrdup(cp); /* make copy */ ap = brkstring (cp, " ", "\n"); /* split string */ /* Count number of arguments split */ -- 2.56.1 From 88a0a47b98a8810bb585e4ae57c5e704087744cd Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 04/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/netsec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbr/netsec.c b/sbr/netsec.c index c31e7295..788b23bf 100644 --- a/sbr/netsec.c +++ b/sbr/netsec.c @@ -1002,7 +1002,7 @@ netsec_set_sasl_params(netsec_context *nsc, const char *hostname, return NOTOK; } - nsc->sasl_hostname = getcpy(hostname); + nsc->sasl_hostname = mh_xstrdup(hostname); #else /* CYRUS_SASL */ NMH_UNUSED(hostname); NMH_UNUSED(service); @@ -1017,7 +1017,7 @@ netsec_set_sasl_params(netsec_context *nsc, const char *hostname, if (mechanism) { char *p; - nsc->sasl_mech = getcpy(mechanism); + nsc->sasl_mech = mh_xstrdup(mechanism); for (p = nsc->sasl_mech; *p; p++) if (isascii((unsigned char) *p)) /* Just in case */ @@ -1200,7 +1200,7 @@ netsec_negotiate_sasl(netsec_context *nsc, const char *mechlist, char **errstr) return NOTOK; } - nsc->sasl_chosen_mech = getcpy(nsc->sasl_mech); + nsc->sasl_chosen_mech = mh_xstrdup(nsc->sasl_mech); if (mh_oauth_do_xoauth(nsc->ns_userid, nsc->oauth_service, &xoauth_client_res, &xoauth_client_res_len, -- 2.56.1 From d253d4786c1712e9015474fae318e4e0a239ba88 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 05/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/oauth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbr/oauth.c b/sbr/oauth.c index 2aedf82c..00e5ba21 100755 --- a/sbr/oauth.c +++ b/sbr/oauth.c @@ -142,7 +142,7 @@ mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res, if (log != NULL) mh_oauth_log_to(stderr, ctx); - fn = getcpy(mh_oauth_cred_fn(svc)); + fn = mh_xstrdup(mh_oauth_cred_fn(svc)); fp = lkfopendata(fn, "r+", &failed_to_lock); if (fp == NULL) { if (errno == ENOENT) { @@ -182,7 +182,7 @@ mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res, free(fn); /* XXX writeBase64raw modifies the source buffer! make a copy */ - client_res = getcpy(mh_oauth_sasl_client_response(oauth_res_len, user, + client_res = mh_xstrdup(mh_oauth_sasl_client_response(oauth_res_len, user, cred)); mh_oauth_cred_free(cred); mh_oauth_free(ctx); -- 2.56.1 From 82c05140c9784bddd74415f79c3b342ad908dceb Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 06/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/oauth_prof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/oauth_prof.c b/sbr/oauth_prof.c index dc9bf2d0..a3f2e54a 100644 --- a/sbr/oauth_prof.c +++ b/sbr/oauth_prof.c @@ -74,7 +74,7 @@ update_svc_field(char **field, const char *base_name, const char *svc) const char *value = context_find(name); if (value != NULL) { free(*field); - *field = getcpy(value); + *field = mh_xstrdup(value); } free(name); } -- 2.56.1 From 3bc058fd4a216b5eed88562eb3581a1fc766e613 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 07/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/path.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbr/path.c b/sbr/path.c index 871ad22d..fca85229 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -70,13 +70,13 @@ expath (char *name, int flag) && strcmp (name, DOT) && strcmp (name, DOTDOT) && strncmp (name, PWD, NPWD)))) - return getcpy (name); + return mh_xstrdup(name); if (pwds == NULL) pwds = pwd (); if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0) - return getcpy (pwds); + return mh_xstrdup(pwds); ep = pwds + strlen (pwds); if ((cp = strrchr(pwds, '/')) == NULL) @@ -90,7 +90,7 @@ expath (char *name, int flag) if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) { snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds); - return getcpy (buffer); + return mh_xstrdup(buffer); } if (strncmp (name, PWD, NPWD) == 0) @@ -99,7 +99,7 @@ expath (char *name, int flag) cp = ep; snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name); - return getcpy (buffer); + return mh_xstrdup(buffer); } -- 2.56.1 From c160a87394ae341395eba70fc54a2846d0cd86af Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 08/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/readconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 1fe9d036..5b72113c 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -64,9 +64,9 @@ readconfig (struct node **npp, FILE *ib, const char *file, int ctx) NEW(np); *npp = np; *(npp = &np->n_next) = NULL; - np->n_name = getcpy (name); + np->n_name = mh_xstrdup(name); if (state == FLDPLUS) { - cp = getcpy (field); + cp = mh_xstrdup(field); while (state == FLDPLUS) { fieldsz = sizeof field; state = m_getfld (&gstate, name, field, &fieldsz, ib); -- 2.56.1 From 198f00c283e412e27e0b2828eb5490206bfcba37 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 09/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/seq_read.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbr/seq_read.c b/sbr/seq_read.c index 759dba49..6f807c65 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -88,16 +88,16 @@ seq_public (struct msgs *mp, int lockflag, int *failed_to_lock) case FLD: case FLDPLUS: if (state == FLDPLUS) { - cp = getcpy (field); + cp = mh_xstrdup(field); while (state == FLDPLUS) { fieldsz = sizeof field; state = m_getfld (&gstate, name, field, &fieldsz, fp); cp = add (field, cp); } - seq_init (mp, getcpy (name), trimcpy (cp)); + seq_init (mp, mh_xstrdup(name), trimcpy (cp)); free (cp); } else { - seq_init (mp, getcpy (name), trimcpy (field)); + seq_init (mp, mh_xstrdup(name), trimcpy (field)); } continue; @@ -119,7 +119,7 @@ seq_public (struct msgs *mp, int lockflag, int *failed_to_lock) if (lockflag) { mp->seqhandle = fp; - mp->seqname = getcpy(seqfile); + mp->seqname = mh_xstrdup(seqfile); } else { lkfclosedata (fp, seqfile); } @@ -150,7 +150,7 @@ seq_private (struct msgs *mp) && (j = strlen (np->n_name) - plen) > alen && *(np->n_name + j) == '-' && strcmp (mp->foldpath, np->n_name + j + 1) == 0) { - cp = getcpy (np->n_name + alen); + cp = mh_xstrdup(np->n_name + alen); *(cp + j - alen) = '\0'; if ((i = seq_init (mp, cp, getcpy (np->n_field))) != -1) make_seq_private (mp, i); -- 2.56.1 From e3e136ee56fdb815e408b5764cf0f1e54fe7ad17 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:14 +0100 Subject: [PATCH 10/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/seq_setprev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbr/seq_setprev.c b/sbr/seq_setprev.c index 11de1439..d336e2a9 100644 --- a/sbr/seq_setprev.c +++ b/sbr/seq_setprev.c @@ -8,6 +8,7 @@ */ #include +#include /* * Add all the messages currently SELECTED to @@ -27,7 +28,7 @@ seq_setprev (struct msgs *mp) * and split them. */ if ((cp = context_find (psequence))) { - dp = getcpy (cp); + dp = mh_xstrdup(cp); if (!(ap = brkstring (dp, " ", "\n")) || !*ap) { free (dp); return; -- 2.56.1 From 12bfc38274e1d28d688cb1f3e71e789a41b7c516 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:15 +0100 Subject: [PATCH 11/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/seq_setunseen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbr/seq_setunseen.c b/sbr/seq_setunseen.c index ea18d176..16d028aa 100644 --- a/sbr/seq_setunseen.c +++ b/sbr/seq_setunseen.c @@ -9,6 +9,7 @@ */ #include +#include /* * We scan through the folder and act upon all messages @@ -29,7 +30,7 @@ seq_setunseen (struct msgs *mp, int seen) * and split them. */ if ((cp = context_find (usequence))) { - dp = getcpy (cp); + dp = mh_xstrdup(cp); if (!(ap = brkstring (dp, " ", "\n")) || !*ap) { free (dp); return; -- 2.56.1 From b66f48b0d0caea86ac3ae5e5044e3340be22f1a6 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 13:37:15 +0100 Subject: [PATCH 12/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- sbr/trimcpy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index 7a2ac03a..50e7142e 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -37,7 +37,7 @@ trimcpy (char *cp) } /* now return a copy */ - return getcpy(cp); + return mh_xstrdup(cp); } -- 2.56.1 From c9e182de1cb1448fdc313cd08c3e0c3fd5e3938d Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 14:52:25 +0100 Subject: [PATCH 13/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- uip/ali.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uip/ali.c b/uip/ali.c index abc7f556..158e7ef3 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -117,7 +117,7 @@ main (int argc, char **argv) if ((cp = context_find ("Aliasfile"))) { char *dp = NULL; - for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++) + for (ap = brkstring(dp = mh_xstrdup(cp), " ", "\n"); ap && *ap; ap++) if ((i = alias (*ap)) != AK_OK) adios (NULL, "aliasing error in %s - %s", *ap, akerror (i)); if (dp) -- 2.56.1 From 9acf7ea2c5f9e428d3791f224b54f2e757ace36b Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 14:52:25 +0100 Subject: [PATCH 14/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- uip/aliasbr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uip/aliasbr.c b/uip/aliasbr.c index 8462fbdc..03934416 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -149,7 +149,7 @@ akval (struct aka *ak, char *s) } } - return getcpy (s); + return mh_xstrdup(s); } @@ -479,7 +479,7 @@ add_aka (struct aka *ak, char *pp) return; NEW(ad); - ad->ad_text = getcpy (pp); + ad->ad_text = mh_xstrdup(pp); ad->ad_local = strchr(pp, '@') == NULL && strchr(pp, '!') == NULL; ad->ad_next = NULL; if (ak->ak_addr) -- 2.56.1 From e977b184441df7bc0aed29fa83c9c014dafc0961 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 14:52:25 +0100 Subject: [PATCH 15/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- uip/ap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uip/ap.c b/uip/ap.c index dff6dc43..48117846 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -157,8 +157,8 @@ process (char *arg, int length) while ((cp = getname (arg))) { NEW0(p); if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) { - p->pq_text = getcpy (cp); - p->pq_error = getcpy (error); + p->pq_text = mh_xstrdup(cp); + p->pq_error = mh_xstrdup(error); status++; } else { -- 2.56.1 From ef3d1c488ff7104fc473561ff066f242077b4e6b Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 18 Oct 2016 14:52:25 +0100 Subject: [PATCH 16/16] Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- uip/comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uip/comp.c b/uip/comp.c index a11f1b7d..a98e24e2 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -223,7 +223,7 @@ main (int argc, char **argv) } } - cwd = getcpy (pwd ()); + cwd = mh_xstrdup(pwd ()); if (!context_find ("path")) free (path ("./", TFOLDER)); @@ -271,7 +271,7 @@ main (int argc, char **argv) if (mp->numsel > 1) adios (NULL, "only one message at a time!"); - if ((in = open (form = getcpy (m_name (mp->lowsel)), O_RDONLY)) == NOTOK) + if ((in = open (form = mh_xstrdup(m_name (mp->lowsel)), O_RDONLY)) == NOTOK) adios (form, "unable to open message"); } else { struct comp *cptr; -- 2.56.1