From: Tollef Fog Heen Date: Sat, 1 Oct 2005 10:13:57 +0000 (+0000) Subject: Fix possible off-by-one X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d840e70463fc985a2c482a7e263ff237ecf570b;p=pkg-config Fix possible off-by-one Apply last part of patch from freedesktop #4034 so we don't do silly things if len is zero. --- 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);