Index: sandbox/linux/suid/linux_util.c |
diff --git a/sandbox/linux/suid/linux_util.c b/sandbox/linux/suid/linux_util.c |
index ded545bdbab51f596dd3c6f695374b2d2af6b60c..c5af0d0d1dc9672abdf324774e95013ab5f1e55e 100644 |
--- a/sandbox/linux/suid/linux_util.c |
+++ b/sandbox/linux/suid/linux_util.c |
@@ -83,8 +83,9 @@ bool FindProcessHoldingSocket(pid_t* pid_out, ino_t socket_inode) { |
continue; |
while ((dent = readdir(fd))) { |
- if (snprintf(buf, sizeof(buf), "/proc/%lu/fd/%s", pid_ul, |
- dent->d_name) >= sizeof(buf) - 1) { |
+ int printed = snprintf(buf, sizeof(buf), "/proc/%lu/fd/%s", pid_ul, |
+ dent->d_name); |
+ if (printed < 0 || printed >= (int)(sizeof(buf) - 1)) { |
continue; |
} |