summaryrefslogtreecommitdiffstats
path: root/plugins/omsnmp/omsnmp.c
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2008-02-11 11:53:41 +0000
committerAndre Lorbach <alorbach@adiscon.com>2008-02-11 11:53:41 +0000
commitf758dae5f04d2eaa333374c0c3880f4c1ffef6d5 (patch)
treeca7002a68a5893030f421b1df32cb8e87f4f51dc /plugins/omsnmp/omsnmp.c
parentdb34f56bc7659610bac378a3adc44cb934b60476 (diff)
downloadrsyslog-f758dae5f04d2eaa333374c0c3880f4c1ffef6d5.tar.gz
rsyslog-f758dae5f04d2eaa333374c0c3880f4c1ffef6d5.tar.xz
rsyslog-f758dae5f04d2eaa333374c0c3880f4c1ffef6d5.zip
replaced sprintf with more secure snprintf calls
Diffstat (limited to 'plugins/omsnmp/omsnmp.c')
-rw-r--r--plugins/omsnmp/omsnmp.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index 6333b7ab..47f3ee95 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -123,17 +123,6 @@ BEGINtryResume
CODESTARTtryResume
ENDtryResume
-
-/*
-* Helper function - not used yet!
-*/
-/* NOT NEEDED AT ALL
-static int snmp_input_sender(int operation, netsnmp_session * session, int reqid, netsnmp_pdu *pdu, void *magic)
-{
- return 1;
-}
-*/
-
static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
{
DEFiRet;
@@ -214,7 +203,7 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
/* Set uptime */
sysuptime = get_uptime();
- sprintf(csysuptime, "%ld", sysuptime);
+ snprintf( csysuptime, sizeof(csysuptime) , "%ld", sysuptime);
trap = csysuptime;
snmp_add_var(pdu, objid_sysuptime, sizeof(objid_sysuptime) / sizeof(oid), 't', trap);
@@ -401,7 +390,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
pData->iTrapType = iTrapType;
/* Create string for session peername! */
- sprintf( (char*) pData->szTargetAndPort, "%s:%s:%d", pData->szTransport, pData->szTarget, pData->iPort );
+ snprintf( (char*) pData->szTargetAndPort, sizeof(pData->szTargetAndPort) / sizeof(char), "%s:%s:%d", pData->szTransport, pData->szTarget, pData->iPort );
/* Print Debug info */
dbgprintf("SNMPTransport: %s\n", pData->szTransport);