From e1fb4764cde22dd3e58ee9b6bc6b687ac19eb61f Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 18 Dec 2023 10:04:43 +0100 Subject: conf/pam_conv1: Avoid signed line numbers Very long input files could overflow the signed integer, which is undefined behavior. Avoid it by using a large unsigned type. Co-authored-by: Benny Baumann Signed-off-by: Tobias Stoeckmann --- conf/pam_conv1/pam_conv_l.l | 2 +- conf/pam_conv1/pam_conv_y.y | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'conf') diff --git a/conf/pam_conv1/pam_conv_l.l b/conf/pam_conv1/pam_conv_l.l index 2d973475..db5ab6b9 100644 --- a/conf/pam_conv1/pam_conv_l.l +++ b/conf/pam_conv1/pam_conv_l.l @@ -17,7 +17,7 @@ #include "pam_conv_y.h" - extern int current_line; + extern unsigned long long current_line; %} %option noyywrap diff --git a/conf/pam_conv1/pam_conv_y.y b/conf/pam_conv1/pam_conv_y.y index 67409103..95010b2f 100644 --- a/conf/pam_conv1/pam_conv_y.y +++ b/conf/pam_conv1/pam_conv_y.y @@ -24,7 +24,7 @@ extern int yylex(void); - int current_line=1; + unsigned long long current_line=1; extern char *yytext; /* XXX - later we'll change this to be the specific conf file(s) */ @@ -191,7 +191,7 @@ void yyerror(const char *format, ...) { va_list args; - fprintf(stderr, "line %d: ", current_line); + fprintf(stderr, "line %llu: ", current_line); va_start(args, format); vfprintf(stderr, format, args); va_end(args); -- cgit v1.2.3