On Wed, Sep 15, 2010 at 12:01 PM, Fulko Hew <[email protected]> wrote:
> On Wed, Sep 15, 2010 at 11:23 AM, Dave Shield
> <[email protected]>wrote:
>
>> On 14 September 2010 16:55, Fulko Hew <[email protected]> wrote:
>> > When I ran this test, the agent died and needed to be restarted.
>> > The variable I was querying was:
>> >
>> > 1.3.6.1.4.1.2021.8.1.103.4294967295 aka 'UCD-SNMP-MIB:extIndex'.
>>
>
The same style of problem exists and I've attached a similar set of patches
for
./agent/mibgroup/ucd-snmp/disk.c
tested with: snmpgetnext -v1 -cpublic -Ir localhost
1.3.6.1.4.1.2021.9.1.101.4294967294
A similar problem may exist elsewhere, but these have been the
only two I've stumbled across using my automated client tester.
Fulko
--- disk.c.orig 2010-09-15 14:08:02.000000000 -0400
+++ disk.c 2010-09-15 14:08:06.000000000 -0400
@@ -167,9 +167,9 @@
#define MAX_INT_32 0x7fffffff
#define MAX_UINT_32 0xffffffff
-int numdisks;
+unsigned int numdisks;
int allDisksIncluded = 0;
-int maxdisks = 0;
+unsigned int maxdisks = 0;
struct diskpart *disks;
struct variable2 extensible_disk_variables[] = {
@@ -238,7 +238,7 @@
static void
disk_free_config(void)
{
- int i;
+ unsigned int i;
numdisks = 0;
for (i = 0; i < maxdisks; i++) { /* init/erase disk db */
@@ -429,7 +429,7 @@
int disk_exists(char *path)
{
- int index;
+ unsigned int index;
for(index = 0; index < numdisks; index++) {
DEBUGMSGTL(("ucd-snmp/disk", "Checking for %s. Found %s at %d\n", path, disks[index].path, index));
if(strcmp(path, disks[index].path) == 0) {
@@ -808,7 +808,8 @@
int exact,
size_t * var_len, WriteMethod ** write_method)
{
- int ret, disknum = 0;
+ int ret;
+ unsigned int disknum = 0;
struct dsk_entry entry;
static long long_ret;
static char errmsg[300];
@@ -818,6 +819,8 @@
(vp, name, length, exact, var_len, write_method, numdisks))
return (NULL);
disknum = name[*length - 1] - 1;
+ if (disknum > maxdisks)
+ return NULL;
switch (vp->magic) {
case MIBINDEX:
long_ret = disknum + 1;
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders