Skip to content
  • Philip Withnall's avatar
    gitypelib: Fix iterating through typelib prefixes · 14d196a6
    Philip Withnall authored
    
    
    The iteration code used `g_string_overwrite_len()` to try and simplify
    buffer allocation and growth, but seemingly forgot to handle the fact
    that it doesn’t nul-terminate what it overwrites: the method is intended
    to be used to splice bits into longer strings, not to overwrite an
    entire nul-terminated string.
    
    This meant that when iterating over a comma-separated `c_prefix` like
    `GUnix,G`, on the second iteration `g_string_overwrite_len()` would be
    used to write `G` into index 0 of the already-set `GUnix` string in the
    buffer, leading to the first iteration happening all over again and the
    `G` prefix being ignored.
    
    This led to symbols failing to be matched to the `GioUnix` typelib, even
    though they should have been.
    
    This will be checked by a test in the following commit.
    
    Signed-off-by: default avatarPhilip Withnall <pwithnall@gnome.org>
    
    Helps: #3303
    14d196a6