mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-02-04 02:30:26 +01:00
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:
parent
3fd0e37e65
commit
6d840e7046
1 changed files with 2 additions and 1 deletions
3
pkg.c
3
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue