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.)
This commit is contained in:
Thomas Schmitt 2011-04-11 20:19:35 +02:00
parent 9210a57500
commit 76b6737570

View File

@ -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;