diff options
-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 @@ | |||
33 | 33 | ||
34 | void trim(char *s) | 34 | void trim(char *s) |
35 | { | 35 | { |
36 | int len=strlen(s); | 36 | int len = strlen(s); |
37 | |||
38 | /* sanity check */ | ||
39 | if (len == 0) | ||
40 | return; | ||
37 | 41 | ||
38 | /* trim trailing whitespace */ | 42 | /* trim trailing whitespace */ |
39 | while ( len > 0 && isspace(s[len-1])) | 43 | while ( len > 0 && isspace(s[len-1])) |