summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-01-17 14:41:28 -0700
committerStephen Warren <swarren@nvidia.com>2013-01-17 14:07:42 -0800
commitacbfad4efb1922674ca1ec4e2e446c3ee5a19164 (patch)
tree2de12bf015002182950972b8158562eff7d67214
parent0bbfaf91d1bfdf1bebf884d100e874e4e6b16b6a (diff)
downloadnvidia-cbootimage-acbfad4efb1922674ca1ec4e2e446c3ee5a19164.tar.gz
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 <fercerpav@gmail.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Change-Id: I018e32df9a87b7c6f9fe24d108e091a7b31a50c8 Reviewed-on: http://git-master/r/192151 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Allen Martin <amartin@nvidia.com>
-rw-r--r--parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 60c5274..464ee8f 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;