make m_dupstr return NULL if the string was empty.
[apps/madmutt.git] / imap / util.c
index 992423e..8e6832b 100644 (file)
 #include "config.h"
 
 #include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
 
 #include "mutt.h"
 #include "mx.h"                 /* for M_IMAP */
-#include "ascii.h"
 #include "url.h"
 #include "imap_private.h"
 #include "mutt_ssl.h"
@@ -443,7 +443,7 @@ void imap_unmunge_mbox_name (char *s)
   buf = m_strdup(s);
   if (buf) {
     imap_utf7_decode (&buf);
-    strncpy (s, buf, m_strlen(s));
+    m_strcpy(s, m_strlen(s) + 1, buf);
   }
 
   p_delete(&buf);