]> granicus.if.org Git - nethack/commit
static analyzer bit
authorPatR <rankin@nethack.org>
Sun, 18 Feb 2018 02:54:52 +0000 (18:54 -0800)
committerPatR <rankin@nethack.org>
Sun, 18 Feb 2018 02:54:52 +0000 (18:54 -0800)
commit48af4fa25969df9b6bcdb211b01c6cc53094279f
tree3b3a74e9b697c4cb3e7c80110fc976ae017fd577
parent544b9015ff78a73ac91b5e76f6c3a1405e6f703f
static analyzer bit

I can't find the original message at the moment, but one of the things
that an analyzer complained about was the *s='\0' possibly assigning
to a Null pointer.  The superfluous test of 's' in the while condition
has fooled it into thinking that's possible when it's not.

if (s) {
  while (s && ...) {
    *s++ = ...
  }
  *s = '\0';
}
src/hacklib.c