author | saurabh.vyas@oracle.com |
Tue, 04 Apr 2017 10:36:17 -0700 | |
changeset 7828 | f7ee70770225 |
parent 6282 | f8c1b6069673 |
permissions | -rw-r--r-- |
6282
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
1 |
This patch fixes a Solaris specific issue with buffer overrun of |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
2 |
if_nameindex->if_name. Memory for this buffer is allocated by |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
3 |
if_nameindex() and therefore correct string routines must be used |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
4 |
to access it. The patch has been submitted to the community |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
5 |
but has not been accepted yet. |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
6 |
|
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
7 |
The details can be found in the following location |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
8 |
https://sourceforge.net/p/net-snmp/bugs/2721/ |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
9 |
|
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
10 |
--- a/agent/mibgroup/kernel_sunos5.c.orig 2016-06-22 21:01:43.093780856 -0700 |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
11 |
+++ b/agent/mibgroup/kernel_sunos5.c 2016-06-22 21:07:14.515956349 -0700 |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
12 |
@@ -1541,7 +1541,7 @@ |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
13 |
ifnp->if_index != 0 && (i < nentries); ifnp++) { |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
14 |
|
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
15 |
DEBUGMSGTL(("kernel_sunos5", "...... getif %s\n", ifnp->if_name)); |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
16 |
- memcpy(lifrp->lifr_name, ifnp->if_name, LIFNAMSIZ); |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
17 |
+ strlcpy(lifrp->lifr_name, ifnp->if_name, LIFNAMSIZ); |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
18 |
if_isv6 = B_FALSE; |
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
19 |
|
f8c1b6069673
22956724 snmpd attempts to read memory past an allocated buffer
Ivo Raisr <ivo.raisr@oracle.com>
parents:
diff
changeset
|
20 |
flags_unknown = B_FALSE; |