diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-10-07 01:34:46 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-10-07 01:34:46 (GMT) |
commit | 0505e9fb07a5bd701efd3ce335a6dc8e13cbd6e1 (patch) | |
tree | 4afca31a68c8ea7f9c629fe5db9cb774d54f9fa1 /plugins/popen.c | |
parent | 90b6597ce4c8f64b28d892960d95c8bf7ea71598 (diff) | |
download | monitoring-plugins-0505e9fb07a5bd701efd3ce335a6dc8e13cbd6e1.tar.gz |
make sure we do not run past the end of an unterminated string
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@108 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/popen.c')
-rw-r--r-- | plugins/popen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index cde3c76..d056904 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -302,8 +302,9 @@ char * | |||
302 | rtrim (char *str, const char *tok) | 302 | rtrim (char *str, const char *tok) |
303 | { | 303 | { |
304 | int i = 0; | 304 | int i = 0; |
305 | int j = sizeof (str); | ||
305 | 306 | ||
306 | while (str != NULL) { | 307 | while (str != NULL && i < j) { |
307 | if (*(str + i) == *tok) { | 308 | if (*(str + i) == *tok) { |
308 | sprintf (str + i, "%s", "\0"); | 309 | sprintf (str + i, "%s", "\0"); |
309 | return str; | 310 | return str; |