Fix possible off-by-one

Apply last part of patch from freedesktop #4034 so we don't do silly
things if len is zero.
This commit is contained in:
Tollef Fog Heen 2005-10-01 10:13:57 +00:00
parent 3fd0e37e65
commit 6d840e7046

3
pkg.c
View file

@ -1241,7 +1241,8 @@ packages_get_var (GSList *pkgs,
}
/* chop last space */
str->str[str->len - 1] = '\0';
if (str->len > 0)
str->str[str->len - 1] = '\0';
retval = str->str;
g_string_free (str, FALSE);