blob: 7d54727b204d58524def687c8bed3b649c027340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
Description: nullstr is not NULL-terminated
Index: illumos-net-tools/usr/src/cmd/cmd-inet/usr.bin/netstat/unix.c
===================================================================
--- illumos-net-tools.orig/usr/src/cmd/cmd-inet/usr.bin/netstat/unix.c 2012-10-08 00:25:23.000000000 +0000
+++ illumos-net-tools/usr/src/cmd/cmd-inet/usr.bin/netstat/unix.c 2013-03-17 00:37:46.492881214 +0000
@@ -120,10 +120,11 @@
pas = &((char *)psi)[sizeof (struct sockinfo)];
/* Create a string of NALEN "0"'s for NULL addresses. */
- if ((nullstr = calloc(1, NALEN)) == NULL) {
+ if ((nullstr = malloc(NALEN + 1)) == NULL) {
fail(0, "print_kn: out of memory\n");
}
(void) memset((void *)nullstr, '0', NALEN);
+ nullstr[NALEN] = '\0';
(void) printf("\nActive UNIX domain sockets\n");
(void) printf("%-8.8s %-10.10s %8.8s %8.8s "
|