diff options
| author | Dusan Durech <dusan.d@centrum.sk> | 2008-11-15 16:08:21 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan.d@centrum.sk> | 2008-11-15 16:08:21 +0100 |
| commit | 35084eaadf8b37f5c4a325f0d4b01767753ee9c3 (patch) | |
| tree | 8ca9a541783690eb6087a52faafa75e9a53d1521 /src/client/configFile.c | |
| parent | 98875c5a636f50fe89b9394b8193e86094ae14e0 (diff) | |
modification coding stile
Diffstat (limited to 'src/client/configFile.c')
| -rw-r--r-- | src/client/configFile.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/configFile.c b/src/client/configFile.c index afdbf9f..74509fe 100644 --- a/src/client/configFile.c +++ b/src/client/configFile.c @@ -30,18 +30,22 @@ int getValue(char *line, char *env, char *val, int len) strcpy(clone_env, env); offset_env = strstr(line, clone_env); + if (offset_env == NULL) return -1; offset_val_begin = strchr(offset_env, '"'); + if (offset_val_begin == NULL) return -1; offset_val_end = strchr(offset_val_begin + 1, '"'); + if (offset_val_end == NULL) return -1; val_len = (int) (offset_val_end - (offset_val_begin + 1)); + if (val_len > len - 1) val_len = len - 1; @@ -63,14 +67,17 @@ char *setValue(char *line, char *env, char *val) strcpy(clone_env, env); offset_env = strstr(line, clone_env); + if (offset_env == NULL) return NULL; offset_val_begin = strchr(offset_env, '"'); + if (offset_val_begin == NULL) return NULL; offset_val_end = strchr(offset_val_begin + 1, '"'); + if (offset_val_end == NULL) return NULL; @@ -124,9 +131,7 @@ int setValueInConfigFile(textFile_t * textFile, char *env, char *val) return -1; } -void -loadValueFromConfigFile(textFile_t * textFile, char *env, char *val, int len, - char *butVal) +void loadValueFromConfigFile(textFile_t * textFile, char *env, char *val, int len, char *butVal) { strcpy(val, butVal); |