ref: 601c0417613ffed5b82603655da013fe944e3464
parent: 33a532e8a82e6ae310dbb2a26d47378516c31702
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 6 07:42:05 EDT 2015
kernel: limit syscallfmt user strings to 64K (as in validname)
--- a/sys/src/9/port/syscallfmt.c
+++ b/sys/src/9/port/syscallfmt.c
@@ -36,8 +36,8 @@
static void
fmtuserstring(Fmt* f, char* a, char* suffix)
{+ char *t, *e;
int n;
- char *t;
if(a == nil){fmtprint(f, "0/\"\"%s", suffix);
@@ -44,7 +44,10 @@
return;
}
validaddr((uintptr)a, 1, 0);
- n = ((char*)vmemchr(a, 0, ~0) - a) + 1;
+ n = 1<<16;
+ e = vmemchr(a, 0, n);
+ if(e != nil)
+ n = e - a;
t = smalloc(n+1);
memmove(t, a, n);
t[n] = 0;
--
⑨