s3/printing: cppcheck avoid 'nullPointerArithmetic:' error
authorNoel Power <noel.power@suse.com>
Tue, 21 May 2019 11:56:06 +0000 (12:56 +0100)
committerNoel Power <npower@samba.org>
Wed, 29 May 2019 10:10:23 +0000 (10:10 +0000)
commit02017d35f43b69b988841b29bd68c5b440edb4e7
tree9cff2921833bdd56befa76d7367d84675a52a1ef
parent5477b83db28c67743e25a638c93bc4117a8a7ced
s3/printing: cppcheck avoid 'nullPointerArithmetic:' error

source3/printing/notify.c:94: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
/home/samba/samba-pidl/source3/printing/notify.c:96: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
/home/samba/samba-pidl/source3/printing/notify.c:103: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]

flatten_message function depends on behaviour of tdb_pack which will
return the bytes that would be written (without actually writing to the
buffer) if the bufsize passed is <=0. What we need to avoid here is the
default modification of buf (when it is initially NULL)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/printing/notify.c