[syslinux:elflink] font: write to 'fontbuf', not random memory
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Tue Jun 4 04:03:03 PDT 2013
Commit-ID: 41a12f1bd7fb8f05d2b7c5568e3f919b086ed944
Gitweb: http://www.syslinux.org/commit/41a12f1bd7fb8f05d2b7c5568e3f919b086ed944
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 4 Jun 2013 11:50:17 +0100
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 4 Jun 2013 11:55:10 +0100
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 at intel.com>
---
core/font.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/core/font.c b/core/font.c
index 35f1b28..81eb90c 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 */
More information about the Syslinux-commits
mailing list