• iniReadFile() can read lines one character longer than other ini read

    From Deucе@VERT to GitLab issue in main/sbbs on Saturday, October 04, 2025 21:45:52
    open https://gitlab.synchro.net/main/sbbs/-/issues/982

    Here: https://gitlab.synchro.net/main/sbbs/-/blob/master/src/xpdev/ini_file.c#L2962

    iniReadFile() passes INI_MAX_LINE_LEN as the max line length to strListReadFile(), which results in list having lines up to INI_MAX_LINE_LEN bytes long in it, but INI_MAX_LINE_LEN is documented as including the NUL. The strListReadFile() argument does not include space for the NUL, which is added to the malloc() and fgets() arguments.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab issue in main/sbbs on Saturday, October 04, 2025 22:29:15
    close https://gitlab.synchro.net/main/sbbs/-/issues/982

    ---
    � Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to GitLab issue in main/sbbs on Saturday, October 04, 2025 23:47:53
    reopen https://gitlab.synchro.net/main/sbbs/-/issues/982

    Here: https://gitlab.synchro.net/main/sbbs/-/blob/master/src/xpdev/ini_file.c#L2962

    iniReadFile() passes INI_MAX_LINE_LEN as the max line length to strListReadFile(), which results in list having lines up to INI_MAX_LINE_LEN bytes long in it, but INI_MAX_LINE_LEN is documented as including the NUL. The strListReadFile() argument does not include space for the NUL, which is added to the malloc() and fgets() arguments.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to GitLab note in main/sbbs on Saturday, October 04, 2025 23:47:54
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7706

    Fun fact, strListReadFile() retains the newline (if any) and it gets stripped in iniReadFile()... so now iniReadFile() will read one fewer characters except for the last line if it doesn't have a trailing newline.

    So I guess tehnically, you broke it. :smiley:

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to GitLab note in main/sbbs on Saturday, October 04, 2025 23:48:05
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7706

    Fun fact, strListReadFile() retains the newline (if any) and it gets stripped in iniReadFile()... so now iniReadFile() will read one fewer characters except for the last line if it doesn't have a trailing newline.

    So I guess technically, you broke it. :smiley:

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Sunday, October 05, 2025 01:00:57
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7707

    So.. I should just revert the change?

    ---
    � Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to GitLab note in main/sbbs on Sunday, October 05, 2025 08:51:44
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7709

    Well, and maybe add a comment...

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net