Skip to content
  • Michael Catanzaro's avatar
    7c6b11df
    giochannel: ensure line terminator remains nul-terminated if needed · 7c6b11df
    Michael Catanzaro authored and Philip Withnall's avatar Philip Withnall committed
    If the user passes -1 length to g_io_channel_set_line_term() along with
    a nul-terminated string, then calls g_io_channel_get_line_term() and
    decides to treat the result as nul-terminated rather than checking the
    length parameter, then the application will have a problem, because it's
    not nul-terminated. That's weird, since the input string was. Let's
    ensure the result is consistent: if you pass a nul-terminated string,
    the result is nul-terminated. If not, it's not.
    
    Also add a warning to g_io_channel_get_line_term(), since it's very
    strange for a gchar * return value to be anything other than a
    nul-terminated UTF-8 string. This is an API design bug, but we cannot
    fix it.
    7c6b11df
    giochannel: ensure line terminator remains nul-terminated if needed
    Michael Catanzaro authored and Philip Withnall's avatar Philip Withnall committed
    If the user passes -1 length to g_io_channel_set_line_term() along with
    a nul-terminated string, then calls g_io_channel_get_line_term() and
    decides to treat the result as nul-terminated rather than checking the
    length parameter, then the application will have a problem, because it's
    not nul-terminated. That's weird, since the input string was. Let's
    ensure the result is consistent: if you pass a nul-terminated string,
    the result is nul-terminated. If not, it's not.
    
    Also add a warning to g_io_channel_get_line_term(), since it's very
    strange for a gchar * return value to be anything other than a
    nul-terminated UTF-8 string. This is an API design bug, but we cannot
    fix it.
Loading