mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 15:58:18 +00:00
Merge pull request #2570 from pacovn/Coverity_1448386_Untrusted_value_as_argument
lib: untrusted argument (Coverity 1448386)
This commit is contained in:
commit
7f3ad069d7
@ -31,9 +31,11 @@
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user