From a8268e761905ba5ab65686b378d824c994135266 Mon Sep 17 00:00:00 2001 From: Nikolay Dimitrov Date: Sat, 21 Dec 2013 10:22:17 +0800 Subject: [PATCH] fix dropmask dereference even when NULL Signed-off-by: Nikolay Dimitrov --- lib/output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/output.c b/lib/output.c index c8e85a567..990cc6c2f 100644 --- a/lib/output.c +++ b/lib/output.c @@ -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: