libc: idn2utf()/utf2idn(): check for < 1 buffer, can't insert terminating NUL.
This commit is contained in:
parent
32665f51c7
commit
1051b023a8
1 changed files with 6 additions and 0 deletions
|
@ -191,6 +191,9 @@ idn2utf(char *name, char *buf, int nbuf)
|
||||||
Rune rb[Domlen], r;
|
Rune rb[Domlen], r;
|
||||||
int nc, nr, n;
|
int nc, nr, n;
|
||||||
|
|
||||||
|
if(nbuf < 1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
cp = name;
|
cp = name;
|
||||||
dp = buf;
|
dp = buf;
|
||||||
de = dp+nbuf-1;
|
de = dp+nbuf-1;
|
||||||
|
@ -231,6 +234,9 @@ utf2idn(char *name, char *buf, int nbuf)
|
||||||
Rune rb[Domlen], r;
|
Rune rb[Domlen], r;
|
||||||
int nc, nr, n;
|
int nc, nr, n;
|
||||||
|
|
||||||
|
if(nbuf < 1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
dp = buf;
|
dp = buf;
|
||||||
de = dp+nbuf-1;
|
de = dp+nbuf-1;
|
||||||
cp = name;
|
cp = name;
|
||||||
|
|
Loading…
Reference in a new issue