]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/clippy.c
zebra: silence harmless ioctl warning when retrieving interface speed
[mirror_frr.git] / lib / clippy.c
index bcec6c2ccab3113a76183729b2047e642445686e..44dcc02eb8645b765a5ee04ccd5a363b8aa45bd7 100644 (file)
 #define pychar wchar_t
 static wchar_t *wconv(const char *s)
 {
-       size_t outlen = mbstowcs(NULL, s, 0);
+       size_t outlen = s ? mbstowcs(NULL, s, 0) : 0;
        wchar_t *out = malloc((outlen + 1) * sizeof(wchar_t));
-       mbstowcs(out, s, outlen + 1);
+
+       if (outlen > 0)
+               mbstowcs(out, s, outlen);
        out[outlen] = 0;
        return out;
 }