diff options
author | Chris Robinson <[email protected]> | 2013-06-19 23:24:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-06-19 23:24:06 -0700 |
commit | ed0568bb24ecd331bd34029d2a34bfb9f1dd3f57 (patch) | |
tree | 39a2e5473182491263b19c0510af1fd338ef261e | |
parent | 160e901381614ee398b3316c3d0491a9da534355 (diff) |
Fix a potential infinite loop.
If the first XDG_CONFIG_DIRS entry isn't a proper relative path,
it would never break the loop.
-rw-r--r-- | Alc/alcConfig.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c index accc0716..98c0df32 100644 --- a/Alc/alcConfig.c +++ b/Alc/alcConfig.c @@ -223,19 +223,20 @@ void ReadALConfig(void) else next = buffer; if(next[0] != '/') - continue; + WARN("Ignoring XDG config dir: %s\n", next); + else { size_t len = strlen(next); strncpy(next+len, "/alsoft.conf", buffer+sizeof(buffer)-next-len); buffer[sizeof(buffer)-1] = 0; - } - TRACE("Loading config %s...\n", next); - f = fopen(next, "r"); - if(f) - { - LoadConfigFromFile(f); - fclose(f); + TRACE("Loading config %s...\n", next); + f = fopen(next, "r"); + if(f) + { + LoadConfigFromFile(f); + fclose(f); + } } if(next == buffer) break; |