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:
Karl DeBisschop 2002-10-07 01:34:46 +00:00
parent 90b6597ce4
commit 0505e9fb07

View file

@ -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;