libgimpbase: don't allow parasites with zero-length names

Check in gimp_parasite_new() and fail GValue validation for parasites
with empty name. So far we only disallowed NULL names, this change
forbids the empty string "" too.
This commit is contained in:
Michael Natterer 2014-03-17 09:34:56 +01:00
parent b2de783030
commit 245106f320
1 changed files with 2 additions and 1 deletions

View File

@ -140,6 +140,7 @@ gimp_param_parasite_validate (GParamSpec *pspec,
return TRUE;
}
else if (parasite->name == NULL ||
*parasite->name == '\0' ||
! g_utf8_validate (parasite->name, -1, NULL) ||
(parasite->size == 0 && parasite->data != NULL) ||
(parasite->size > 0 && parasite->data == NULL))
@ -216,7 +217,7 @@ gimp_parasite_new (const gchar *name,
{
GimpParasite *parasite;
if (!name)
if (! (name && *name))
return NULL;
parasite = g_slice_new (GimpParasite);