From d7ac9cc00f8ba41af2d8c78daf1b81869fad032c Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Sun, 10 Dec 2017 19:42:02 +0000 Subject: [PATCH] Enforce PostNet and PLANET lengths Fix suggested by Milton Neal --- backend/postal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/postal.c b/backend/postal.c index 241ecd9a..13be8b57 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -91,8 +91,8 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int error_number = 0; - if (length > 38) { - strcpy(symbol->errtxt, "480: Input too long"); + if (length != 5 && length != 9 && length != 11) { + strcpy(symbol->errtxt, "480: Input wrong length"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); @@ -157,8 +157,8 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int error_number = 0; - if (length > 38) { - strcpy(symbol->errtxt, "482: Input too long"); + if (length != 11 && length != 13) { + strcpy(symbol->errtxt, "482: Input wrong length"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length);