@@ -615,13 +615,13 @@ STATIC void test308()
615615 }
616616 }
617617
618- sprintf (temp , "t307#%X" , ntohl (dir ));
618+ snprintf (temp , sizeof ( temp ) , "t307#%X" , ntohl (dir ));
619619
620620 if (!FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , 0 , bitmap )) {
621621 test_failed ();
622622 }
623623
624- sprintf (temp , "t308#%X" , ntohl (dir ));
624+ snprintf (temp , sizeof ( temp ) , "t308#%X" , ntohl (dir ));
625625
626626 if (!FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , 0 , bitmap )) {
627627 test_failed ();
@@ -683,10 +683,10 @@ STATIC void test324()
683683 test_nottested ();
684684 }
685685
686- sprintf (temp1 , "#%X.txt" , ntohl (id ));
686+ snprintf (temp1 , sizeof ( temp1 ) , "#%X.txt" , ntohl (id ));
687687 memset (temp , 0 , sizeof (temp ));
688688 strncpy (temp , name , 31 - strlen (temp1 ));
689- strcat (temp , temp1 );
689+ strlcat (temp , temp1 , sizeof ( temp ) );
690690
691691 if (FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
692692 test_failed ();
@@ -738,10 +738,10 @@ STATIC void test326()
738738 goto test_exit ;
739739 }
740740
741- sprintf (temp1 , "#%X.txt" , ntohl (id ));
741+ snprintf (temp1 , sizeof ( temp1 ) , "#%X.txt" , ntohl (id ));
742742 memset (temp , 0 , sizeof (temp ));
743743 strncpy (temp , name , 31 - strlen (temp1 ));
744- strcat (temp , temp1 );
744+ strlcat (temp , temp1 , sizeof ( temp ) );
745745 ret = FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 );
746746
747747 if ((Conn -> afp_version >= 30 && ret != ntohl (AFPERR_NOOBJ ))
@@ -789,19 +789,19 @@ STATIC void test333()
789789 test_nottested ();
790790 }
791791
792- sprintf (temp1 , "#%X.txt" , ntohl (id ));
792+ snprintf (temp1 , sizeof ( temp1 ) , "#%X.txt" , ntohl (id ));
793793 memset (temp , 0 , sizeof (temp ));
794794 strncpy (temp , name , 31 - strlen (temp1 ));
795- strcat (temp , temp1 );
795+ strlcat (temp , temp1 , sizeof ( temp ) );
796796
797797 if (FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
798798 test_failed ();
799799 }
800800
801- sprintf (temp1 , "#0%X.txt" , ntohl (id ));
801+ snprintf (temp1 , sizeof ( temp1 ) , "#0%X.txt" , ntohl (id ));
802802 memset (temp , 0 , sizeof (temp ));
803803 strncpy (temp , name , 31 - strlen (temp1 ));
804- strcat (temp , temp1 );
804+ strlcat (temp , temp1 , sizeof ( temp ) );
805805
806806 if (!FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
807807 test_failed ();
@@ -846,19 +846,19 @@ STATIC void test334()
846846 test_nottested ();
847847 }
848848
849- sprintf (temp1 , "#%X" , ntohl (id ));
849+ snprintf (temp1 , sizeof ( temp1 ) , "#%X" , ntohl (id ));
850850 memset (temp , 0 , sizeof (temp ));
851851 strncpy (temp , name , 31 - strlen (temp1 ));
852- strcat (temp , temp1 );
852+ strlcat (temp , temp1 , sizeof ( temp ) );
853853
854854 if (FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
855855 test_failed ();
856856 }
857857
858- sprintf (temp1 , "#%X." , ntohl (id ));
858+ snprintf (temp1 , sizeof ( temp1 ) , "#%X." , ntohl (id ));
859859 memset (temp , 0 , sizeof (temp ));
860860 strncpy (temp , name , 31 - strlen (temp1 ));
861- strcat (temp , temp1 );
861+ strlcat (temp , temp1 , sizeof ( temp ) );
862862
863863 if (!FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
864864 test_failed ();
@@ -912,10 +912,10 @@ STATIC void test335()
912912 test_nottested ();
913913 }
914914
915- sprintf (temp1 , "#%X.txt" , ntohl (id ));
915+ snprintf (temp1 , sizeof ( temp1 ) , "#%X.txt" , ntohl (id ));
916916 memset (temp , 0 , sizeof (temp ));
917917 strncpy (temp , name , 31 - strlen (temp1 ));
918- strcat (temp , temp1 );
918+ strlcat (temp , temp1 , sizeof ( temp ) );
919919
920920 if (FPGetFileDirParams (Conn , vol , DIRDID_ROOT , temp , bitmap , 0 )) {
921921 test_failed ();
@@ -1250,7 +1250,6 @@ static void do_pdinfo_test(char *fname, const char *fourcc, uint8_t expect_type,
12501250 int ofs = 3 * sizeof (uint16_t );
12511251 const DSI * dsi = & Conn -> dsi ;
12521252 struct afp_filedir_parms filedir = { 0 };
1253- const unsigned char * buf ;
12541253 const char * creator = "pdos" ;
12551254 uint8_t prodos_type ;
12561255 uint16_t prodos_aux ;
@@ -1343,7 +1342,6 @@ STATIC void test441()
13431342 int ofs = 3 * sizeof (uint16_t );
13441343 const DSI * dsi = & Conn -> dsi ;
13451344 struct afp_filedir_parms filedir = { 0 };
1346- const unsigned char * buf ;
13471345 uint8_t prodos_type ;
13481346 uint16_t prodos_aux ;
13491347 ENTER_TEST
@@ -1404,7 +1402,6 @@ STATIC void test442()
14041402 int ofs = 3 * sizeof (uint16_t );
14051403 const DSI * dsi = & Conn -> dsi ;
14061404 struct afp_filedir_parms filedir = { 0 };
1407- const unsigned char * buf ;
14081405 uint8_t prodos_type ;
14091406 uint16_t prodos_aux ;
14101407 int dir ;
0 commit comments