From 76b67375708e85e14e89421822856ba8077e7599 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 11 Apr 2011 20:19:35 +0200 Subject: [PATCH] Bug fix: While loading an ISO image several reads to malloc memory occured with byte index -1. (Found by Valgrind after years of operation without visible problems.) --- libisofs/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libisofs/util.c b/libisofs/util.c index 7d880bf..8bd0df8 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -1536,16 +1536,17 @@ char *iso_util_strcopy(const char *buf, size_t len) return str; } -char *iso_util_strcopy_untail(const char *buf, size_t len) +char *iso_util_strcopy_untail(const char *buf, size_t len_in) { char *str; + int len; - str = iso_util_strcopy(buf, len); + str = iso_util_strcopy(buf, len_in); if (str == NULL) { return NULL; } /* remove trailing spaces */ - for (len = len-1; len >= 0; --len) { + for (len = len_in - 1; len >= 0; --len) { if (str[len] != ' ') break; str[len] = 0;