@@ -1479,7 +1479,7 @@ static int doLoadUsr(char *args[])
14791479 /* get program and component name */
14801480 if (name_flag ) {
14811481 new_comp_name = * args ++ ;
1482- prog_name = * args ++ ;
1482+ prog_name = * args ++ ;
14831483 } else {
14841484 new_comp_name = prog_name = * args ++ ;
14851485 }
@@ -2880,7 +2880,7 @@ static cmdResponseType setUnload(char *s, connectionRecType *context)
28802880
28812881static cmdResponseType setLoadUsr (char * s , connectionRecType * context )
28822882{
2883- char * argv [MAX_TOK + 1 ];
2883+ char * argv [MAX_TOK + 1 ] = { 0 } ;
28842884
28852885 argv [0 ] = s ;
28862886 argv [1 ] = "\0" ;
@@ -3472,11 +3472,11 @@ int main(int argc, char **argv)
34723472 // process halrmt command line args
34733473 while ((opt = getopt_long (argc , argv , "e:n:p:s:w:" , longopts , NULL )) != -1 ) {
34743474 switch (opt ) {
3475- case 'e' : strncpy (enablePWD , optarg , strlen ( optarg ) + 1 ); break ;
3476- case 'n' : strncpy (serverName , optarg , strlen ( optarg ) + 1 ); break ;
3475+ case 'e' : snprintf (enablePWD , sizeof ( enablePWD ), "%s" , optarg ); break ;
3476+ case 'n' : snprintf (serverName , sizeof ( serverName ), "%s" , optarg ); break ;
34773477 case 'p' : sscanf (optarg , "%d" , & port ); break ;
34783478 case 's' : sscanf (optarg , "%d" , & maxSessions ); break ;
3479- case 'w' : strncpy (pwd , optarg , strlen ( optarg ) + 1 ); break ;
3479+ case 'w' : snprintf (pwd , sizeof ( pwd ), "%s" , optarg ); break ;
34803480 }
34813481 }
34823482
0 commit comments