aboutsummaryrefslogtreecommitdiff
path: root/src/libventi
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2011-12-12 16:44:50 -0500
committerRuss Cox <rsc@swtch.com>2011-12-12 16:44:50 -0500
commit73392c2c7cc2e74759480a37e345366dfa265926 (patch)
treed0da620850b6e6778ad0cdeff6705b7d0fcf3a69 /src/libventi
parentca81de0ae174e737cf3594787fa885e51d6e9d1d (diff)
downloadplan9port-73392c2c7cc2e74759480a37e345366dfa265926.tar.gz
plan9port-73392c2c7cc2e74759480a37e345366dfa265926.tar.bz2
plan9port-73392c2c7cc2e74759480a37e345366dfa265926.zip
libventi: fix segfault in vtreadpacket when not connected
This problem happens especially in fossil/view when vtread can be called even if not connected to venti. The old libventi handle this case properly in the function vtRPC, which is called by vtReadPacket (client.c). R=rsc CC=plan9port.codebot http://codereview.appspot.com/5484044
Diffstat (limited to 'src/libventi')
-rw-r--r--src/libventi/client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libventi/client.c b/src/libventi/client.c
index 9f200f48..f76fd343 100644
--- a/src/libventi/client.c
+++ b/src/libventi/client.c
@@ -65,6 +65,11 @@ vtreadpacket(VtConn *z, uchar score[VtScoreSize], uint type, int n)
if(memcmp(score, vtzeroscore, VtScoreSize) == 0)
return packetalloc();
+ if(z == nil){
+ werrstr("not connected");
+ return nil;
+ }
+
if(z->version[1] == '2' && n >= (1<<16)) {
werrstr("read count too large for protocol");
return nil;