From acbfad4efb1922674ca1ec4e2e446c3ee5a19164 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 17 Jan 2013 14:41:28 -0700 Subject: [PATCH] Fix type of variable used to store fgetc() result fgetc() returns an int. Fix process_config_file() to store the result in an int, so that comparisons against EOF succeed. Previously, If "char" defaulted to unsigned (which may be true for armhf), then when fgetc() returned -1, it would be truncated to 255 when stored in the char, and then zero-filled rather than sign-extended when comparing against EOF, which would then fail. See http://code.google.com/p/chromium-os/issues/detail?id=25632. Reported-by: Paul Fertser Signed-off-by: Stephen Warren Change-Id: I018e32df9a87b7c6f9fe24d108e091a7b31a50c8 Reviewed-on: http://git-master/r/192151 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Allen Martin --- parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse.c b/parse.c index 60c5274057..464ee8ff40 100644 --- a/parse.c +++ b/parse.c @@ -702,7 +702,7 @@ void process_config_file(build_image_context *context, u_int8_t simple_parse) { char buffer[MAX_BUFFER]; int space = 0; - char current; + int current; u_int8_t c_eol_comment_start = 0; /* True after first slash */ u_int8_t comment = 0; u_int8_t string = 0;