summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2021-11-19 09:52:10 +0100
committerMartin Burnicki <martin.burnicki@meinberg.de>2021-11-19 09:52:10 +0100
commit48dc952dd92518a63f27dca9b18f7c742b6afd83 (patch)
tree679377337e5090e78eb87ed74ec9a4134b39ede8
parent711d9ed080242255118f6d4187d3abb8d49e04a5 (diff)
downloadntptest-48dc952dd92518a63f27dca9b18f7c742b6afd83.tar.gz
ntptest-48dc952dd92518a63f27dca9b18f7c742b6afd83.zip
Fix a potential infinite loop with getopt
The loop while ( ( c = getopt( argc, argv, ... ) ) != -1 ) never ends if c is a char, and the char type is unsigned by default. Reported by Mickael GARDET <m.gardet@overkiz.com> for an ARM-32 system.
-rwxr-xr-xntptest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ntptest.c b/ntptest.c
index 2425319..d33d7eb 100755
--- a/ntptest.c
+++ b/ntptest.c
@@ -429,7 +429,7 @@ void usage( void )
static /*HDR*/
void check_options( int argc, char *argv[] )
{
- char c;
+ int c;
#if defined( MBG_TGT_WIN32 )
#define WIN32_OPTS "L"