]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "Fix the "Use-after-free" of clang SA." 429/head
authorHung-Weic Chiu <sppsorrg@gmail.com>
Tue, 2 May 2017 00:28:41 +0000 (00:28 +0000)
committerHung-Weic Chiu <sppsorrg@gmail.com>
Tue, 2 May 2017 00:33:15 +0000 (00:33 +0000)
- This's the wrong way to fix this problem.
- Since the "TAILQ_FIRST()" always return diferent pointer as we call "TAILQ_REMOVE()", the clang static analyzer can't detect this behavior.
- Ignore this warning and keep files identical to its original one.

This reverts commit 5d6cc38ca36538583ff4c464c46a7c6de08608b6.

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
lib/imsg-buffer.c
lib/imsg.c

index f7b9f63778f4564a7346671b7f80d017e57271ab..a486fc17c18d35329eb245ca2d4a051ba3e3fb03 100644 (file)
@@ -209,10 +209,8 @@ msgbuf_clear(struct msgbuf *msgbuf)
 {
        struct ibuf     *buf;
 
-       while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) {
+       while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL)
                ibuf_dequeue(msgbuf, buf);
-               TAILQ_FIRST(&msgbuf->bufs) = NULL;
-       }
 }
 
 int
index df3cdf510c52c3233d69579efa35cab8b7fae73b..246430cdd5a56c026c2d0494be9a53b78a3c9246 100644 (file)
@@ -310,7 +310,6 @@ imsg_get_fd(struct imsgbuf *ibuf)
        fd = ifd->fd;
        TAILQ_REMOVE(&ibuf->fds, ifd, entry);
        free(ifd);
-       TAILQ_FIRST(&ibuf->fds) = NULL;
 
        return (fd);
 }