Skip to content
  • Thomas Haller's avatar
    keyfile: ensure array lengths are always initialized · abe84859
    Thomas Haller authored
    Several callers access the length output argument, expecting
    it to be zero also on failure. That is a bug, because glib does
    not guarantee that.
    
    Fix that by making a stronger promise from our wrappers: the output
    argument should also be set on failure.
    
    Also ensure that calls to g_keyfile_get_groups() and
    g_keyfile_get_keys() don't rely on the length output to be valid,
    when the function call fails.
    
    Actually, these issues were not severe because:
    
    - `g_key_file_get_*_list()`'s implementation always sets the output length
      even on failure (undocumented).
    - `g_key_file_get_groups()` cannot fail and always set the length.
    - `g_key_file_get_keys()` is called under circumstances where it won't
      fail.
    
    Still, be explicit about it.
    abe84859