libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit b9e53e008d8b641ef98927f13563dc7347f03bea
parent abecb2f8abe99d821c9b0dda3a14e0e6d1f94fcd
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu,  4 Oct 2018 10:09:08 +0200

Use UCHAR_MAX as maxval in strtonum() for 24-bit ANSI sequences

Diffstat:
Msrc/loaders/ansi.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -360,14 +360,14 @@ int ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) seqGrab = strndup((char *)ctx->buffer + loop + 2, ansi_sequence_loop); seqTok = strtok(seqGrab, ";"); - seqValue = strtonum(seqTok, 0, UINT32_MAX, &errstr); + seqValue = strtonum(seqTok, 0, UCHAR_MAX, &errstr); seqTok = strtok(NULL, ";"); - color_R = strtonum(seqTok, 0, INT32_MAX, &errstr) & 0xff; + color_R = strtonum(seqTok, 0, UCHAR_MAX, &errstr) & 0xff; seqTok = strtok(NULL, ";"); - color_G = strtonum(seqTok, 0, INT32_MAX, &errstr) & 0xff; + color_G = strtonum(seqTok, 0, UCHAR_MAX, &errstr) & 0xff; seqTok = strtok(NULL, ";"); - color_B = strtonum(seqTok, 0, INT32_MAX, &errstr) & 0xff; + color_B = strtonum(seqTok, 0, UCHAR_MAX, &errstr) & 0xff; if (seqValue == 0) background = (color_R << 16) | (color_G << 8) | color_B;