commit 2a1b882566691b5168468ab8cb5af4d97e294788
parent 67b6bfdbd9b8c694509134cc2ab38c150aab6eb2
Author: Frederic Cambus <fred@statdns.com>
Date: Tue, 22 Sep 2020 23:34:25 +0200
Add bound checks for {back,fore}ground color values in the PCBoard loader.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c
@@ -91,6 +91,12 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options)
background = ctx->buffer[loop+2];
foreground = ctx->buffer[loop+3];
loop += 3;
+
+ if (background > PCB_COLORS ||
+ foreground > PCB_COLORS) {
+ ctx->error = ANSILOVE_FORMAT_ERROR;
+ goto error;
+ }
}
if (!memcmp(cursor, "CLS", 3)) {