mirror of
https://github.com/sarah-walker-pcem/pcem.git
synced 2025-07-23 03:33:02 +02:00
Avoid segmentation fault loading config file with Windows \r\n line endings (#252)
The problem doesn't seem to occur in Windows, only in Linux (and presumably *nix in general) when trying to load a config file that was created (and perhaps hand-edited) in Windows.
This commit is contained in:
@@ -199,7 +199,7 @@ void config_load(int is_global, char *fn) {
|
||||
|
||||
data_pos = c;
|
||||
while (buffer[c]) {
|
||||
if (buffer[c] == '\n')
|
||||
if (buffer[c] == '\n' || buffer[c] == '\r')
|
||||
buffer[c] = 0;
|
||||
c++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user