From 6d840e70463fc985a2c482a7e263ff237ecf570b Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sat, 1 Oct 2005 10:13:57 +0000 Subject: [PATCH] Fix possible off-by-one Apply last part of patch from freedesktop #4034 so we don't do silly things if len is zero. --- pkg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg.c b/pkg.c index 70ff9ce..dbb4288 100644 --- a/pkg.c +++ b/pkg.c @@ -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); -- 2.39.5