mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
Protect against stupid bsearch() implementations. (#159737, Morten
2004-11-29 Matthias Clasen <mclasen@redhat.com> * xdgmimeparent.c (_xdg_mime_parent_list_lookup): * xdgmimealias.c (_xdg_mime_alias_list_lookup): Protect against stupid bsearch() implementations. (#159737, Morten Welinder)
This commit is contained in:
parent
05ea39152c
commit
a9dc6decd2
@ -1,3 +1,10 @@
|
||||
2004-11-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* xdgmimeparent.c (_xdg_mime_parent_list_lookup):
|
||||
* xdgmimealias.c (_xdg_mime_alias_list_lookup): Protect
|
||||
against stupid bsearch() implementations. (#159737,
|
||||
Morten Welinder)
|
||||
|
||||
2004-11-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* xdgmimeparent.c (_xdg_mime_parent_read_from_file):
|
||||
|
@ -99,13 +99,16 @@ _xdg_mime_alias_list_lookup (XdgAliasList *list,
|
||||
XdgAlias *entry;
|
||||
XdgAlias key;
|
||||
|
||||
key.alias = (char *)alias;
|
||||
key.mime_type = 0;
|
||||
|
||||
entry = bsearch (&key, list->aliases, list->n_aliases,
|
||||
sizeof (XdgAlias), alias_entry_cmp);
|
||||
if (entry)
|
||||
return entry->mime_type;
|
||||
if (list->n_aliases > 0)
|
||||
{
|
||||
key.alias = (char *)alias;
|
||||
key.mime_type = 0;
|
||||
|
||||
entry = bsearch (&key, list->aliases, list->n_aliases,
|
||||
sizeof (XdgAlias), alias_entry_cmp);
|
||||
if (entry)
|
||||
return entry->mime_type;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -104,13 +104,16 @@ _xdg_mime_parent_list_lookup (XdgParentList *list,
|
||||
XdgMimeParents *entry;
|
||||
XdgMimeParents key;
|
||||
|
||||
key.mime = (char *)mime;
|
||||
key.parents = NULL;
|
||||
|
||||
entry = bsearch (&key, list->parents, list->n_mimes,
|
||||
sizeof (XdgMimeParents), &parent_entry_cmp);
|
||||
if (entry)
|
||||
return (const char **)entry->parents;
|
||||
if (list->n_mimes > 0)
|
||||
{
|
||||
key.mime = (char *)mime;
|
||||
key.parents = NULL;
|
||||
|
||||
entry = bsearch (&key, list->parents, list->n_mimes,
|
||||
sizeof (XdgMimeParents), &parent_entry_cmp);
|
||||
if (entry)
|
||||
return (const char **)entry->parents;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user