mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
Make sure snarf is <64kB, since the wire count
is only 16 bits.
This commit is contained in:
parent
dc9d0ffc75
commit
efc2b0c99e
1 changed files with 11 additions and 4 deletions
|
@ -646,10 +646,17 @@ hsetsnarf(int nc)
|
|||
if(n >= 0){
|
||||
if(!s1)
|
||||
n = 0;
|
||||
s1 = realloc(s1, n+1);
|
||||
if (!s1)
|
||||
panic("realloc");
|
||||
s1[n] = 0;
|
||||
if(n > 65535){
|
||||
s1 = strdup("<snarf too long>");
|
||||
if (!s1)
|
||||
panic("strdup");
|
||||
n = strlen(s1);
|
||||
}else{
|
||||
s1 = realloc(s1, n+1);
|
||||
if (!s1)
|
||||
panic("realloc");
|
||||
s1[n] = 0;
|
||||
}
|
||||
snarflen = n;
|
||||
outTs(Tsetsnarf, n);
|
||||
if(n>0 && write(hostfd[1], s1, n)!=n)
|
||||
|
|
Loading…
Reference in a new issue