aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-18 11:46:39 -0700
committerChris Robinson <[email protected]>2011-09-18 11:46:39 -0700
commitd46db2f648e7d00ae138fb98bd0ee49014c501a6 (patch)
treeeb2e086d62e309c03bd0869098d4f575d42c7327
parent6d77aabb23f9e0f3def9cb17b9d00a603a6aa061 (diff)
Avoid a buffer underrun when getting the end of a config option value
-rw-r--r--Alc/alcConfig.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c
index 82375f40..b8c04743 100644
--- a/Alc/alcConfig.c
+++ b/Alc/alcConfig.c
@@ -62,7 +62,7 @@ static void LoadConfigFromFile(FILE *f)
while(fgets(buffer, sizeof(buffer), f))
{
- size_t i = 0;
+ ssize_t i = 0;
while(isspace(buffer[i]))
i++;
@@ -74,6 +74,7 @@ static void LoadConfigFromFile(FILE *f)
if(buffer[0] == '[')
{
ConfigBlock *nextBlock;
+ size_t i;
i = 1;
while(buffer[i] && buffer[i] != ']')
@@ -194,7 +195,7 @@ static void LoadConfigFromFile(FILE *f)
i++;
do {
i--;
- } while(isspace(buffer[i]));
+ } while(i >= 0 && isspace(buffer[i]));
buffer[++i] = 0;
free(ent->value);