diff options
author | rsc <devnull@localhost> | 2004-03-02 20:02:13 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-02 20:02:13 +0000 |
commit | efc2b0c99e1a4f9d2be9e72785d566df903c66fb (patch) | |
tree | 0d951b3c325a9cc5363c29b299f2a09d1289df0f /src/cmd/samterm | |
parent | dc9d0ffc7558dacde0df81ff3b278fa6f356f46f (diff) | |
download | plan9port-efc2b0c99e1a4f9d2be9e72785d566df903c66fb.tar.gz plan9port-efc2b0c99e1a4f9d2be9e72785d566df903c66fb.tar.bz2 plan9port-efc2b0c99e1a4f9d2be9e72785d566df903c66fb.zip |
Make sure snarf is <64kB, since the wire count
is only 16 bits.
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r-- | src/cmd/samterm/mesg.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/cmd/samterm/mesg.c b/src/cmd/samterm/mesg.c index c332d7a8..0bffad3d 100644 --- a/src/cmd/samterm/mesg.c +++ b/src/cmd/samterm/mesg.c @@ -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) |