NULL pointer dereference in skalibs's mininetstring_write()

2015-03-13 Thread Roman Khimov
Hello. This one was catched by Clang's scan-build: 9 int mininetstring_write (int fd, char const *s, uint16 len, uint32 *w) 10 { 11if (!w) 12{ 13 char pack[2] ; 14 uint16_pack_big(pack, len) ; 15 switch (fd_write(fd, pack, 2)) 16 {

Re: NULL pointer dereference in skalibs's mininetstring_write()

2015-03-13 Thread Laurent Bercot
On 13/03/2015 15:50, Roman Khimov wrote: 11if (!w) That one should be: if (!*w) It's obvious that if 'w' is NULL there will be NULL pointer dereference on line 19 or 20. What's not so obvious is how to properly fix that. Actually, w is never supposed to be NULL. Calling