TIP: Click on subject to list as thread! ANSI
echo: sync_programming
to: Git commit to main/sbbs/m
from: Rob Swindell (on Windows
date: 2024-09-21 13:08:00
subject: src/xpdev/str_list.c

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)

SOURCE: echomail via QWK@pharcyde.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.