@@ -469,7 +469,7 @@ static void uc_list(char *name, size_t name_len)
469
469
}
470
470
471
471
// Special cases
472
- int len = 4 ;
472
+ size_t len = 4 ;
473
473
if (a & EX_BANG ) {
474
474
msg_putchar ('!' );
475
475
len -- ;
@@ -491,7 +491,7 @@ static void uc_list(char *name, size_t name_len)
491
491
}
492
492
493
493
msg_outtrans_attr (cmd -> uc_name , HL_ATTR (HLF_D ));
494
- len = ( int ) strlen (cmd -> uc_name ) + 4 ;
494
+ len = strlen (cmd -> uc_name ) + 4 ;
495
495
496
496
do {
497
497
msg_putchar (' ' );
@@ -500,7 +500,7 @@ static void uc_list(char *name, size_t name_len)
500
500
501
501
// "over" is how much longer the name is than the column width for
502
502
// the name, we'll try to align what comes after.
503
- const int over = len - 22 ;
503
+ const int64_t over = ( int64_t ) len - 22 ;
504
504
len = 0 ;
505
505
506
506
// Arguments
@@ -524,53 +524,57 @@ static void uc_list(char *name, size_t name_len)
524
524
525
525
do {
526
526
IObuff [len ++ ] = ' ' ;
527
- } while (len < 5 - over );
527
+ } while (( int64_t ) len < 5 - over );
528
528
529
529
// Address / Range
530
530
if (a & (EX_RANGE | EX_COUNT )) {
531
531
if (a & EX_COUNT ) {
532
532
// -count=N
533
- snprintf (IObuff + len , IOSIZE , "%" PRId64 "c" , cmd -> uc_def );
534
- len += (int )strlen (IObuff + len );
533
+ int rc = snprintf (IObuff + len , IOSIZE - len , "%" PRId64 "c" , cmd -> uc_def );
534
+ assert (rc > 0 );
535
+ len += (size_t )rc ;
535
536
} else if (a & EX_DFLALL ) {
536
537
IObuff [len ++ ] = '%' ;
537
538
} else if (cmd -> uc_def >= 0 ) {
538
539
// -range=N
539
- snprintf (IObuff + len , IOSIZE , "%" PRId64 "" , cmd -> uc_def );
540
- len += (int )strlen (IObuff + len );
540
+ int rc = snprintf (IObuff + len , IOSIZE - len , "%" PRId64 "" , cmd -> uc_def );
541
+ assert (rc > 0 );
542
+ len += (size_t )rc ;
541
543
} else {
542
544
IObuff [len ++ ] = '.' ;
543
545
}
544
546
}
545
547
546
548
do {
547
549
IObuff [len ++ ] = ' ' ;
548
- } while (len < 8 - over );
550
+ } while (( int64_t ) len < 8 - over );
549
551
550
552
// Address Type
551
553
for (j = 0 ; addr_type_complete [j ].expand != ADDR_NONE ; j ++ ) {
552
554
if (addr_type_complete [j ].expand != ADDR_LINES
553
555
&& addr_type_complete [j ].expand == cmd -> uc_addr_type ) {
554
- STRCPY (IObuff + len , addr_type_complete [j ].shortname );
555
- len += (int )strlen (IObuff + len );
556
+ int rc = snprintf (IObuff + len , IOSIZE - len , "%s" , addr_type_complete [j ].shortname );
557
+ assert (rc > 0 );
558
+ len += (size_t )rc ;
556
559
break ;
557
560
}
558
561
}
559
562
560
563
do {
561
564
IObuff [len ++ ] = ' ' ;
562
- } while (len < 13 - over );
565
+ } while (( int64_t ) len < 13 - over );
563
566
564
567
// Completion
565
568
char * cmd_compl = get_command_complete (cmd -> uc_compl );
566
569
if (cmd_compl != NULL ) {
567
- STRCPY (IObuff + len , get_command_complete (cmd -> uc_compl ));
568
- len += (int )strlen (IObuff + len );
570
+ int rc = snprintf (IObuff + len , IOSIZE - len , "%s" , get_command_complete (cmd -> uc_compl ));
571
+ assert (rc > 0 );
572
+ len += (size_t )rc ;
569
573
}
570
574
571
575
do {
572
576
IObuff [len ++ ] = ' ' ;
573
- } while (len < 25 - over );
577
+ } while (( int64_t ) len < 25 - over );
574
578
575
579
IObuff [len ] = '\0' ;
576
580
msg_outtrans (IObuff );
0 commit comments