summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-03-31 11:18:55 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-01 13:18:28 +0530
commitaa63a122433d51e89148af27dab98cf68846dab4 (patch)
tree30e9828379442196e1bc893f84ca476b5095fc63
parent96b687b9b8d58fc70dfaaed42dbe1b35799117f8 (diff)
Avoid infinite loop while parsing volume specification files on Linux/ARM.
- patch submitted by anonymous user (ref: bug #26006 on savannah). Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--libglusterfs/src/spec.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/libglusterfs/src/spec.y b/libglusterfs/src/spec.y
index 4de77a431ca..f0a0caea122 100644
--- a/libglusterfs/src/spec.y
+++ b/libglusterfs/src/spec.y
@@ -470,8 +470,9 @@ parse_backtick (FILE *srcfp, FILE *dstfp)
int ret = 0, i = 0;
char *cmd = NULL, *result = NULL;
size_t cmd_buf_size = GF_CMD_BUFFER_LEN;
- char escaped = 0, in_backtick = 0, character = 0;
+ char escaped = 0, in_backtick = 0;
int line = 1, column = 0, backtick_line = 0, backtick_column = 0;
+ int character = 0;
fseek (srcfp, 0L, SEEK_SET);
fseek (dstfp, 0L, SEEK_SET);
@@ -486,7 +487,8 @@ parse_backtick (FILE *srcfp, FILE *dstfp)
return -1;
}
- while ((character = fgetc (srcfp)) != EOF) {
+ while (!feof (srcfp)) {
+ character = fgetc (srcfp);
if ((character == '`') && !escaped) {
if (in_backtick) {
cmd[i] = '\0';