summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-09-13 13:51:46 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-09-13 13:51:46 +0000
commit3d7d38401588a2a06f71fab94ab1beaa17bdf309 (patch)
treef57a648242abd61eebaa5dc4148a3a6a4fd12e02
parent8ca8c03346090ece96b4c4b3da5fe2d41b04eb3e (diff)
downloadzabbix-3d7d38401588a2a06f71fab94ab1beaa17bdf309.tar.gz
zabbix-3d7d38401588a2a06f71fab94ab1beaa17bdf309.tar.xz
zabbix-3d7d38401588a2a06f71fab94ab1beaa17bdf309.zip
added incorrect defines to generate error if 'snprintf' and 'sprintf' functions are used (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3300 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--include/common.h3
-rw-r--r--src/libs/zbxsysinfo/common/common.c2
-rwxr-xr-xsrc/libs/zbxsysinfo/win32/diskspace.c4
3 files changed, 6 insertions, 3 deletions
diff --git a/include/common.h b/include/common.h
index 6e97c2dc..162a8c08 100644
--- a/include/common.h
+++ b/include/common.h
@@ -24,6 +24,9 @@
#include "zbxtypes.h"
+#define snprintf ERROR_DO_NOT_USE_SNPRINTF_FUNCTION_TRY_TO_USE_ZBX_SNPRINTF
+#define sprintf ERROR_DO_NOT_USE_SPRINTF_FUNCTION_TRY_TO_USE_ZBX_SNPRINTF
+
#define ON 1
#define OFF 0
diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c
index fe70e32f..fc9baf4e 100644
--- a/src/libs/zbxsysinfo/common/common.c
+++ b/src/libs/zbxsysinfo/common/common.c
@@ -505,7 +505,7 @@ int process(const char *in_command, unsigned flags, AGENT_RESULT *result)
}
else
{
- snprintf(param, MAX_STRING_LEN, "%s", commands[i].main_param);
+ zbx_snprintf(param, sizeof(param), "%s", commands[i].main_param);
}
}
else
diff --git a/src/libs/zbxsysinfo/win32/diskspace.c b/src/libs/zbxsysinfo/win32/diskspace.c
index be74a584..03a1252f 100755
--- a/src/libs/zbxsysinfo/win32/diskspace.c
+++ b/src/libs/zbxsysinfo/win32/diskspace.c
@@ -42,14 +42,14 @@ int VFS_FS_SIZE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT
return SYSINFO_RET_FAIL;
}
- if(get_param(param, 2, mode, 20) != 0)
+ if(get_param(param, 2, mode, sizeof(mode)) != 0)
{
mode[0] = '\0';
}
if(mode[0] == '\0')
{
/* default parameter */
- sprintf(mode, "total");
+ zbx_snprintf(mode, sizeof(mode), "total");
}
if (!GetDiskFreeSpaceEx(path, &freeBytes, &totalBytes, NULL))