|| (NULL == replacement))
return NULL;
- sstrncpy (buf_ptr, string, (off1 + 1 > buflen) ? buflen : off1 + 1);
+ sstrncpy (buf_ptr, string,
+ ((size_t)off1 + 1 > buflen) ? buflen : (size_t)off1 + 1);
buf_ptr += off1;
len -= off1;
strncpy (buf, temp, buflen);
}
- if (i >= 100)
+ if (i >= buflen)
{
WARNING ("subst_string: Loop exited after %zu iterations: "
"string = %s; needle = %s; replacement = %s;",