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:
Frans de Jonge
2024-04-02 21:57:56 +02:00
committed by GitHub
parent 33a4bc6c46
commit c358285c8d

View File

@@ -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++;
}