git: bf57b550264c - stable/13 - vtfontcvt: improve hex font format validation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Jul 2022 13:15:10 UTC
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bf57b550264c45e777acb8b5306076610bd072b6 commit bf57b550264c45e777acb8b5306076610bd072b6 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-07-19 15:20:10 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-07-26 13:15:01 +0000 vtfontcvt: improve hex font format validation Previously an EOF would result in sscanf returning -1 leading to a crash. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- usr.bin/vtfontcvt/vtfontcvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index ba580d863149..d73dd86414f4 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -565,7 +565,7 @@ parse_hex(FILE *fp, unsigned int map_idx) if (bytes != NULL) errx(1, "malformed input: Width tag after font data"); set_width(atoi(ln + 9)); - } else if (sscanf(ln, "%6x:", &curchar)) { + } else if (sscanf(ln, "%6x:", &curchar) == 1) { if (bytes == NULL) { bytes = xmalloc(wbytes * height); bytes_r = xmalloc(wbytes * height);