From: jacob Date: Fri, 29 Aug 2003 22:14:04 +0000 (+0000) Subject: dupstr() should cope with being passed NULL X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/6d1138864fc75651ce79aa2748deb7feba1bac91 dupstr() should cope with being passed NULL git-svn-id: svn://svn.tartarus.org/sgt/putty@3429 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/misc.c b/misc.c index 3fea3746..78d829a9 100644 --- a/misc.c +++ b/misc.c @@ -11,9 +11,12 @@ char *dupstr(const char *s) { - int len = strlen(s); - char *p = snewn(len + 1, char); - strcpy(p, s); + char *p = NULL; + if (s) { + int len = strlen(s); + p = snewn(len + 1, char); + strcpy(p, s); + } return p; }