fix dropmask dereference even when NULL
authorNikolay Dimitrov <ndimitrov@setelis.com>
Sat, 21 Dec 2013 02:22:17 +0000 (10:22 +0800)
committerAndy Green <andy.green@linaro.org>
Sat, 21 Dec 2013 02:22:17 +0000 (10:22 +0800)
Signed-off-by: Nikolay Dimitrov <ndimitrov@setelis.com>
lib/output.c

index c8e85a5..990cc6c 100644 (file)
@@ -555,14 +555,15 @@ do_more_inside_frame:
                /*
                 * in v7, just mask the payload
                 */
-               for (n = 4; n < (int)len + 4; n++)
-                       dropmask[n] = dropmask[n] ^
+               if (dropmask) { /* never set if already inside frame */
+                       for (n = 4; n < (int)len + 4; n++)
+                               dropmask[n] = dropmask[n] ^
                                wsi->u.ws.frame_masking_nonce_04[
                                        (wsi->u.ws.frame_mask_index++) & 3];
 
-               if (dropmask) /* never set if already inside frame */
                        /* copy the frame nonce into place */
                        memcpy(dropmask, wsi->u.ws.frame_masking_nonce_04, 4);
+               }
        }
 
 send_raw: