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

    From Deucе@1:103/705 to GitLab issue in main/sbbs on Sat Oct 4 21:45:52 2025
    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.
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sat Oct 4 22:29:15 2025
    close https://gitlab.synchro.net/main/sbbs/-/issues/982
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab issue in main/sbbs on Sat Oct 4 23:47:53 2025
    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.
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Oct 4 23:47:54 2025
    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:
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sat Oct 4 23:48:05 2025
    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:
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Sun Oct 5 01:00:57 2025
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7707

    So.. I should just revert the change?
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Sun Oct 5 08:51:44 2025
    https://gitlab.synchro.net/main/sbbs/-/issues/982#note_7709

    Well, and maybe add a comment...
    --- SBBSecho 3.30-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)