ref: 1051b023a8ad828574bf4dba17954826ebc33418
parent: 32665f51c7f5637e96fa0713584493e7060a8e98
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 31 08:43:47 EDT 2021
libc: idn2utf()/utf2idn(): check for < 1 buffer, can't insert terminating NUL.
--- a/sys/src/libc/9sys/idn.c
+++ b/sys/src/libc/9sys/idn.c
@@ -191,6 +191,9 @@
Rune rb[Domlen], r;
int nc, nr, n;
+ if(nbuf < 1)
+ return -1;
+
cp = name;
dp = buf;
de = dp+nbuf-1;
@@ -230,6 +233,9 @@
char *dp, *de, *cp;
Rune rb[Domlen], r;
int nc, nr, n;
+
+ if(nbuf < 1)
+ return -1;
dp = buf;
de = dp+nbuf-1;