]> git.tue.mpg.de Git - paraslash.git/commitdiff
vss: Add an assertion for vsst->header_buf.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 18:30:12 +0000 (20:30 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 26 Apr 2017 12:06:45 +0000 (14:06 +0200)
if vsst->header_len > 0 but vsst->header_buf is NULL, something weird
is going on and non-obvious bad things will happen later. The assertion
makes sure we notice early that there is a problem. It also silences a
scan-build warning.

vss.c

diff --git a/vss.c b/vss.c
index 24dfc6bb51af4edf67c645c0d3ccbda2ad8f1868..32e36a997fadadca81df24e12a776b974423420e 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -362,6 +362,7 @@ static void vss_get_chunk(int chunk_num, struct vss_task *vsst,
         * rather than the unmodified header (chunk zero).
         */
        if (chunk_num == 0 && vsst->header_len > 0) {
+               assert(vsst->header_buf);
                *buf = vsst->header_buf; /* stripped header */
                *sz = vsst->header_len;
                return;