diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2013-08-04 07:27:00 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2013-08-04 07:27:00 +0000 |
commit | 8164da9e3e3a679bfa94b477674882922d6e28c8 (patch) | |
tree | f8668084173b6899ef1560715f34b036b1d9cc2c /Str.c | |
parent | Merge from upstream on 2012-05-22 (diff) | |
download | w3m-8164da9e3e3a679bfa94b477674882922d6e28c8.tar.gz w3m-8164da9e3e3a679bfa94b477674882922d6e28c8.zip |
Check length for Strchop()
Diffstat (limited to '')
-rw-r--r-- | Str.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -278,8 +278,8 @@ void Strchop(Str s) { STR_LENGTH_CHECK(s); - while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') && - s->length > 0) { + while (s->length > 0 && + (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) { s->length--; } s->ptr[s->length] = '\0'; |