• src/xpdev/str_list.c

    From deuce@1:103/705 to CVS commit on Thu Mar 8 22:05:45 2018
    src/xpdev str_list.c 1.47 1.48
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv14238

    Modified Files:
    str_list.c
    Log Message:
    Fix a pair of unlikely memory leaks on realloc() failure found by scan-build.



    --- SBBSecho 3.03-Win32
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From deuce@1:103/705 to CVS commit on Thu Mar 8 22:11:37 2018
    src/xpdev str_list.c 1.48 1.49
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv15140

    Modified Files:
    str_list.c
    Log Message:
    Fix bug in last commit.



    --- SBBSecho 3.03-Win32
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Sat Dec 29 18:09:49 2018
    src/xpdev str_list.c 1.49 1.50
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv20463

    Modified Files:
    str_list.c
    Log Message:
    strListFree() will no longer try to dereference the pointer argument if it's NULL.

    --- SBBSecho 3.06-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Fri Feb 8 15:35:41 2019
    src/xpdev str_list.c 1.51 1.52
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv20015

    Modified Files:
    str_list.c
    Log Message:
    Fix Borland C (5.6, not C99 compliant) build issue introduced in previous commit.

    --- SBBSecho 3.06-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Thu Feb 14 01:48:25 2019
    src/xpdev str_list.c 1.52 1.53
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv31705

    Modified Files:
    str_list.c
    Log Message:
    Fix potential for heap corruption in (new function) strListModifyEach():
    If the modify callback function returned a pointer *within* the list item's allocated buffer, the strcpy() would copy from potentialy free'd memory as realloc may change the location of the heap buffer when resizing.
    Fixed by allocating a copy of the returned pointer before freeing the original list item buffer and then just assign the allocated pointer (no copying needed). This likely will result in more heap fragmentation for modified list items are now newly-allocated buffers rather than reallocated existing buffers but the other option would have been to allocate a temporary copy of the string before reallocating and then copying and that would've been a lot more overhead than with this approach.

    This likely fixes any crashes seen in recent revs of v3.17c (e.g. when
    imported QWK or REP packets and text/*.can and the twitlist.cfg are parsed). The sighting on Vertrauen was only in the Windows build and appeared when importing QWK/REP packets.


    --- SBBSecho 3.06-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Fri Mar 20 12:29:53 2020
    src/xpdev str_list.c 1.54 1.55
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv32324

    Modified Files:
    str_list.c
    Log Message:
    The Borland C++/C++Builder (6) that I'm still using doesn't have asprintf() or the necesary functions for a re-implementation of asprintf().

    --- SBBSecho 3.10-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Wed Apr 22 23:58:43 2020
    src/xpdev str_list.c 1.57 1.58
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv3872

    Modified Files:
    str_list.c
    Log Message:
    Avoid some NULL dereferences when passed NULL str_list_t args.

    --- SBBSecho 3.10-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From rswindell@1:103/705 to CVS commit on Mon May 25 19:46:15 2020
    src/xpdev str_list.c 1.60 1.61
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv16156

    Modified Files:
    str_list.c
    Log Message:
    Fix strListDedupe() - if a string is removed (cause it was a dupe), don't increment the second loop counter or you'll skip past the NULL-terminator.

    --- SBBSecho 3.11-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Fri Apr 16 12:22:40 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/bef16f429032791c7f485e54
    Modified Files:
    src/xpdev/str_list.c
    Log Message:
    if strListFind() is passed a NULL 'str' value, return -1 (not found)Return int value for "string not found" rather than crash/segfault. Seems the better option.
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Tue May 4 01:12:22 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/30f63a5c271519872f70285e
    Modified Files:
    src/xpdev/str_list.c
    Log Message:
    NULL pointer checks in strListSort*() and strListDup()
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Sat Jan 21 13:15:16 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/a5ed96ee9e9ba0a52ad07bc1
    Modified Files:
    src/xpdev/str_list.c
    Log Message:
    strListJoin() will now fail gracefully (return NULL) if passed NULL bufNo immediate need/use.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on ChromeOS)@1:103/705 to Git commit to main/sbbs/master on Sat Mar 25 18:46:50 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/b869bf8ca721367548be301d
    Modified Files:
    src/xpdev/str_list.c
    Log Message:
    Fix strListCmp() - apparently never testedThis function is used in sbbs_ini.c, but was always returnning non-zero, evenwhen both string lists were identical. --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Sat Sep 21 13:08:41 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/d49134e6f734b94cc1741418
    Modified Files:
    src/xpdev/str_list.c
    Log Message:
    strListReadFile() now returns NULL on any file read failure

    Previously, the partially-read lines would be returned in an allocated
    string list. This is a suspected cause of issue #791: even though the file was successfully opened exclusively (using sopen... SH_DENYRW), it's possible that Samba had already allowed another client or local process to open the same file, but is now a denying read (most likely, the first read). As Deuce
    pointed out, the xpdev *nix implementation of sopen() locks the region/record of the entire file. So before this change, strListReadFile() might fail on
    the first read, and a function that uses iniFileRead() to modify the contents of an ini file, might end up writing back the empty list (with added keys), thus deleting all the existing content of the file.

    Also in this change:
    - Eliminated the unnecessary local/wrapped str_list_read_file() function.
    - Elminate unecessary null-before-free check
    - Fixed potential memory leak upon malloc failure (the potentially-allocated
    list wasn't freed).
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)