@@ -64,10 +64,12 @@ static int config_sort_compare_func(struct config_entry_list *a,
6464{
6565 if (a && b )
6666 {
67- if (a -> key && b -> key )
68- return strcasecmp (a -> key , b -> key );
69- else if (a -> key )
67+ if (a -> key )
68+ {
69+ if (b -> key )
70+ return strcasecmp (a -> key , b -> key );
7071 return 1 ;
72+ }
7173 else if (b -> key )
7274 return -1 ;
7375 }
@@ -1179,20 +1181,23 @@ void config_file_dump_orbis(config_file_t *conf, int fd)
11791181 while (includes )
11801182 {
11811183 char cad [256 ];
1182- sprintf (cad ,"#include %s\n" , includes -> path );
1184+ snprintf (cad , sizeof (cad ),
1185+ "#include %s\n" , includes -> path );
11831186 orbisWrite (fd , cad , strlen (cad ));
11841187 includes = includes -> next ;
11851188 }
11861189
1187- list = merge_sort_linked_list ((struct config_entry_list * )conf -> entries , config_sort_compare_func );
1190+ list = merge_sort_linked_list ((struct config_entry_list * )
1191+ conf -> entries , config_sort_compare_func );
11881192 conf -> entries = list ;
11891193
11901194 while (list )
11911195 {
11921196 if (!list -> readonly && list -> key )
11931197 {
11941198 char newlist [256 ];
1195- sprintf (newlist ,"%s = %s\n" , list -> key , list -> value );
1199+ snprintf (newlist , sizeof (newlist ),
1200+ "%s = %s\n" , list -> key , list -> value );
11961201 orbisWrite (fd , newlist , strlen (newlist ));
11971202 }
11981203 list = list -> next ;
0 commit comments