File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,28 @@ int main(int argc, char **argv)
506
506
break ;
507
507
508
508
case 'd' :
509
- str_to_ulong_strict (optarg , & max_loops , 10 );
509
+ { /* scoping */
510
+ unsigned long ul = 0 ;
511
+ if (str_to_ulong (optarg , & ul , 10 )) {
512
+ #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP ) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS ) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE ) )
513
+ # pragma GCC diagnostic push
514
+ #endif
515
+ #ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS
516
+ # pragma GCC diagnostic ignored "-Wtype-limits"
517
+ #endif
518
+ #ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE
519
+ # pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"
520
+ #endif
521
+ if (ul < SIZE_MAX )
522
+ max_loops = (size_t )ul ;
523
+ else
524
+ upslogx (LOG_ERR , "Invalid max loops" );
525
+ #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP ) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS ) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE ) )
526
+ # pragma GCC diagnostic pop
527
+ #endif
528
+ } else
529
+ upslogx (LOG_ERR , "Invalid max loops" );
530
+ }
510
531
break ;
511
532
512
533
case 'f' :
You can’t perform that action at this time.
0 commit comments