[PATCH rebase] peflags: Fix ULONG range checks
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Aug 7 18:50:06 GMT 2023
Hi Christian,
On Aug 7 16:07, Christian Franke via Cygwin-apps wrote:
> Minor issue found during tests of the upcoming 'peflags --timestamp' patch.
>
> --
> Regards,
> Christian
>
> From 9da405da78e92dc8263239e25365bee3167f185e Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.franke@t-online.de>
> Date: Mon, 7 Aug 2023 13:42:50 +0200
> Subject: [PATCH] peflags: Fix ULONG range checks
>
> Don't use ULONG_MAX from <limits.h> because ULONG is not necessarily
> 'unsigned long'.
>
> Signed-off-by: Christian Franke <christian.franke@t-online.de>
> ---
> peflags.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/peflags.c b/peflags.c
> index 93eaa0b..d98b121 100644
> --- a/peflags.c
> +++ b/peflags.c
> @@ -30,7 +30,6 @@
> #include <unistd.h>
> #include <getopt.h>
> #include <errno.h>
> -#include <limits.h>
> #if defined (__CYGWIN__) || defined (__MSYS__)
> #include <sys/mman.h>
> #endif
> @@ -598,7 +597,7 @@ handle_num_option (const char *option_name,
> || sizeof_vals[option_index].value > 0x0000ffffffffffffULL
> /* Just a ULONG value */
> || (sizeof_vals[option_index].is_ulong
> - && sizeof_vals[option_index].value > ULONG_MAX))
> + && sizeof_vals[option_index].value > 0x00000000ffffffffULL))
What about using MAXDWORD or MAXULONG32 instead?
Corinna
More information about the Cygwin-apps
mailing list