aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/popen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/popen.c b/plugins/popen.c
index cde3c764..d056904d 100644
--- a/plugins/popen.c
+++ b/plugins/popen.c
@@ -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;