From 6d1138864fc75651ce79aa2748deb7feba1bac91 Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 29 Aug 2003 22:14:04 +0000 Subject: [PATCH] dupstr() should cope with being passed NULL git-svn-id: svn://svn.tartarus.org/sgt/putty@3429 cda61777-01e9-0310-a592-d414129be87e --- misc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.11.0