summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index bd0526ce..adb1d192 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -219,7 +219,7 @@ size_t _alpm_strip_newline(char *str)
return 0;
}
len = strlen(str);
- while(str[len - 1] == '\n') {
+ while(len > 0 && str[len - 1] == '\n') {
len--;
}
str[len] = '\0';