]> git.lizzy.rs Git - plan9front.git/commitdiff
vncv: fix snarf buffer realloc memory corruption
authorqwx <devnull@localhost>
Mon, 26 Aug 2019 15:02:58 +0000 (17:02 +0200)
committerqwx <devnull@localhost>
Mon, 26 Aug 2019 15:02:58 +0000 (17:02 +0200)
fix never updating p when snarf is reallocated,
resulting in memory corruption.

sys/src/cmd/vnc/wsys.c

index 81ffb39d9385ab21e156cc13ff210e31bc1869cc..d4b13b655d8b936fc28cd791c8e8e1d08b92255e 100644 (file)
@@ -281,6 +281,7 @@ getsnarf(int *sz)
                        *sz += c;
                        if (n == 0){
                                snarf = realloc(snarf, *sz + 8192);
+                               p = snarf + *sz;
                                n = 8192;
                        }
                }