Den 19-02-2014 14:11, rohith skrev:
Thanks Tim for the response .

Niels,

Do we have a patch specific to this issue ?

The attached patch has been applied to all branches from 5.4 and forward.

/Niels

--
Niels Baggesen - @home - Ã…rhus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers   ---   R W Hamming
diff --git a/agent/mibgroup/kernel_sunos5.c b/agent/mibgroup/kernel_sunos5.c
index 3270642..9a534fc 100644
--- a/agent/mibgroup/kernel_sunos5.c
+++ b/agent/mibgroup/kernel_sunos5.c
@@ -1002,27 +1002,31 @@ getmib(int groupname, int subgroupname, void **statbuf, size_t *size,
 	    rc = getmsg(sd, NULL, &strbuf, &flags);
 	    switch (rc) {
 	    case -1:
-		rc = -ENOSR;
+		ret = -ENOSR;
+		snmp_perror("getmsg");
 		goto Return;
 
 	    default:
-		rc = -ENODATA;
+		snmp_log(LOG_ERR, "kernel_sunos5/getmib: getmsg returned %d\n", rc);
+		ret = -ENODATA;
 		goto Return;
 
 	    case MOREDATA:
-		oldsize = ( ((void *)strbuf.buf) - *statbuf) + strbuf.len;
-		strbuf.buf = (void *)realloc(*statbuf,oldsize+4096);
+		DEBUGMSGTL(("kernel_sunos5", "...... getmib increased buffer size\n"));
+		oldsize = ( strbuf.buf - (char *)*statbuf) + strbuf.len;
+		strbuf.buf = (char *)realloc(*statbuf, oldsize+4096);
 		if(strbuf.buf != NULL) {
 		    *statbuf = strbuf.buf;
 		    *size = oldsize + 4096;
-		    strbuf.buf = *statbuf + oldsize;
+		    strbuf.buf = (char *)*statbuf + oldsize;
 		    strbuf.maxlen = 4096;
+		    result = NOT_FOUND;
 		    break;
 		}
-		strbuf.buf = *statbuf + (oldsize - strbuf.len);
+		strbuf.buf = (char *)*statbuf + (oldsize - strbuf.len);
 	    case 0:
 		/* fix buffer to real size & position */
-		strbuf.len += ((void *)strbuf.buf) - *statbuf;
+		strbuf.len += strbuf.buf - (char*)*statbuf;
 		strbuf.buf = *statbuf;
 		strbuf.maxlen = *size;
 
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to