kernel: limit syscallfmt user strings to 64K (as in validname)
This commit is contained in:
parent
86eb8ea6bb
commit
9585e9b7f8
1 changed files with 5 additions and 2 deletions
|
@ -36,15 +36,18 @@ fmtrwdata(Fmt* f, char* a, int n, char* suffix)
|
||||||
static void
|
static void
|
||||||
fmtuserstring(Fmt* f, char* a, char* suffix)
|
fmtuserstring(Fmt* f, char* a, char* suffix)
|
||||||
{
|
{
|
||||||
|
char *t, *e;
|
||||||
int n;
|
int n;
|
||||||
char *t;
|
|
||||||
|
|
||||||
if(a == nil){
|
if(a == nil){
|
||||||
fmtprint(f, "0/\"\"%s", suffix);
|
fmtprint(f, "0/\"\"%s", suffix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
validaddr((uintptr)a, 1, 0);
|
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);
|
t = smalloc(n+1);
|
||||||
memmove(t, a, n);
|
memmove(t, a, n);
|
||||||
t[n] = 0;
|
t[n] = 0;
|
||||||
|
|
Loading…
Reference in a new issue