mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-22 22:56:58 -04:00
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
This commit is contained in:
parent
90b6597ce4
commit
0505e9fb07
1 changed files with 2 additions and 1 deletions
|
|
@ -302,8 +302,9 @@ char *
|
|||
rtrim (char *str, const char *tok)
|
||||
{
|
||||
int i = 0;
|
||||
int j = sizeof (str);
|
||||
|
||||
while (str != NULL) {
|
||||
while (str != NULL && i < j) {
|
||||
if (*(str + i) == *tok) {
|
||||
sprintf (str + i, "%s", "\0");
|
||||
return str;
|
||||
|
|
|
|||
Loading…
Reference in a new issue