aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-06-04 11:50:17 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-06-04 11:55:10 +0100
commit41a12f1bd7fb8f05d2b7c5568e3f919b086ed944 (patch)
tree1638a11ea24ec3a125bff935d3a0501d3f10818f
parentc4fa33189f1d725fcd7c7457e45f37e970f5cdac (diff)
downloadsyslinux-41a12f1bd7fb8f05d2b7c5568e3f919b086ed944.tar.gz
syslinux-41a12f1bd7fb8f05d2b7c5568e3f919b086ed944.tar.xz
syslinux-41a12f1bd7fb8f05d2b7c5568e3f919b086ed944.zip
font: write to 'fontbuf', not random memory
commit be5a345d385d ("font: load data as a single block") cleaned up the loop for reading into the font buffer but made the mistake of dropping the assignment to 'p', which means that the _fread() call is writing through a garbage pointer. Since 'p' was only used to keep track while writing into the font buffer in a loop, we can now delete it and reference 'fontbuf' directly. Also delete the unused variable 'i'. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--core/font.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/core/font.c b/core/font.c
index 35f1b28a..81eb90ce 100644
--- a/core/font.c
+++ b/core/font.c
@@ -46,8 +46,6 @@ __export void loadfont(const char *filename)
uint8_t height;
} hdr;
FILE *f;
- char *p;
- int i;
f = fopen(filename, "r");
if (!f)
@@ -71,7 +69,7 @@ __export void loadfont(const char *filename)
/* Load the actual font into the font buffer. */
memset(fontbuf, 0, 256*32);
- if (_fread(p, 256*hdr.height, f) != 256*hdr.height)
+ if (_fread(fontbuf, 256*hdr.height, f) != 256*hdr.height)
goto fail;
/* Loaded OK */