mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 04:15:16 +00:00
lib: untrusted argument (Coverity 1448386)
Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
parent
71a7b1f82f
commit
45ec351df2
@ -31,9 +31,11 @@
|
|||||||
#define pychar wchar_t
|
#define pychar wchar_t
|
||||||
static wchar_t *wconv(const char *s)
|
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));
|
wchar_t *out = malloc((outlen + 1) * sizeof(wchar_t));
|
||||||
mbstowcs(out, s, outlen + 1);
|
|
||||||
|
if (outlen > 0)
|
||||||
|
mbstowcs(out, s, outlen);
|
||||||
out[outlen] = 0;
|
out[outlen] = 0;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user