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)