diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/trim.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/trim.c b/libbb/trim.c index 78cf235dd..d3be62d93 100644 --- a/libbb/trim.c +++ b/libbb/trim.c @@ -33,7 +33,11 @@ void trim(char *s) { - int len=strlen(s); + int len = strlen(s); + + /* sanity check */ + if (len == 0) + return; /* trim trailing whitespace */ while ( len > 0 && isspace(s[len-1])) |