@@ -171,7 +171,7 @@ hc_hello(struct HostConf *hc)
171171 char hostbuf [256 ];
172172 int error ;
173173
174- bzero (hostbuf , sizeof (hostbuf ));
174+ memset (hostbuf , 0 , sizeof (hostbuf ));
175175 if (gethostname (hostbuf , sizeof (hostbuf ) - 1 ) < 0 )
176176 return (-1 );
177177 if (hostbuf [0 ] == 0 )
@@ -232,7 +232,7 @@ rc_hello(hctransaction_t trans, struct HCHead *head)
232232 UseCpFile = strdup (HCC_STRING (item ));
233233 }
234234
235- bzero (hostbuf , sizeof (hostbuf ));
235+ memset (hostbuf , 0 , sizeof (hostbuf ));
236236 if (gethostname (hostbuf , sizeof (hostbuf ) - 1 ) < 0 )
237237 return (-1 );
238238 if (hostbuf [0 ] == 0 )
@@ -287,7 +287,7 @@ hc_decode_stat(hctransaction_t trans, struct stat *st, struct HCHead *head)
287287{
288288 struct HCLeaf * item ;
289289
290- bzero (st , sizeof (* st ));
290+ memset (st , 0 , sizeof (* st ));
291291 FOR_EACH_ITEM (item , trans , head )
292292 hc_decode_stat_item (st , item );
293293 return (0 );
@@ -511,7 +511,8 @@ hc_readdir(struct HostConf *hc, DIR *dir, struct stat **statpp)
511511
512512 if ((sysden = readdir (dir )) == NULL )
513513 return (NULL );
514- strlcpy (denbuf .d_name , sysden -> d_name , sizeof (denbuf .d_name ));
514+ strncpy (denbuf .d_name , sysden -> d_name , sizeof (denbuf .d_name ) - 1 );
515+ denbuf .d_name [sizeof (denbuf .d_name ) - 1 ] = '\0' ;
515516 return (& denbuf );
516517 }
517518
@@ -530,8 +531,10 @@ hc_readdir(struct HostConf *hc, DIR *dir, struct stat **statpp)
530531 return (NULL ); /* XXX errno */
531532 den -> d_name [0 ] = 0 ;
532533 FOR_EACH_ITEM (item , trans , head ) {
533- if (item -> leafid == LC_PATH1 )
534- strlcpy (den -> d_name , HCC_STRING (item ), sizeof (den -> d_name ));
534+ if (item -> leafid == LC_PATH1 ) {
535+ strncpy (den -> d_name , HCC_STRING (item ), sizeof (den -> d_name ) - 1 );
536+ den -> d_name [sizeof (den -> d_name ) - 1 ] = '\0' ;
537+ }
535538 }
536539 return (den -> d_name [0 ] ? den : NULL );
537540 }
@@ -540,10 +543,11 @@ hc_readdir(struct HostConf *hc, DIR *dir, struct stat **statpp)
540543 denbuf .d_name [0 ] = 0 ;
541544 head = (void * )dir ;
542545 * statpp = malloc (sizeof (struct stat ));
543- bzero (* statpp , sizeof (struct stat ));
546+ memset (* statpp , 0 , sizeof (struct stat ));
544547 while ((item = hcc_nextchaineditem (hc , head )) != NULL ) {
545548 if (item -> leafid == LC_PATH1 ) { /* this must be the last item */
546- strlcpy (denbuf .d_name , HCC_STRING (item ), sizeof (denbuf .d_name ));
549+ strncpy (denbuf .d_name , HCC_STRING (item ), sizeof (denbuf .d_name ) - 1 );
550+ denbuf .d_name [sizeof (denbuf .d_name ) - 1 ] = '\0' ;
547551 break ;
548552 } else {
549553 stat_ok = 1 ;
@@ -917,7 +921,7 @@ hc_read(struct HostConf *hc, int fd, void *buf, size_t bytes)
917921 }
918922 else
919923 head -> magic = 0 ; /* all bytes used up */
920- bcopy ( (char * )HCC_BINARYDATA (item ) + offset , buf , x );
924+ memcpy ( buf , (char * )HCC_BINARYDATA (item ) + offset , x );
921925 buf = (char * )buf + x ;
922926 bytes -= (size_t )x ;
923927 r += x ;
@@ -943,7 +947,7 @@ hc_read(struct HostConf *hc, int fd, void *buf, size_t bytes)
943947 x = item -> bytes - sizeof (* item );
944948 if (x > (int )bytes )
945949 x = (int )bytes ;
946- bcopy ( HCC_BINARYDATA (item ), buf , x );
950+ memcpy ( buf , HCC_BINARYDATA (item ), x );
947951 buf = (char * )buf + x ;
948952 bytes -= (size_t )x ;
949953 r += x ;
@@ -1695,7 +1699,7 @@ hc_readlink(struct HostConf *hc, const char *path, char *buf, int bufsiz)
16951699 r = 0 ;
16961700 if (r > bufsiz )
16971701 r = bufsiz ;
1698- bcopy ( HCC_BINARYDATA (item ), buf , r );
1702+ memcpy ( buf , HCC_BINARYDATA (item ), r );
16991703 }
17001704 }
17011705 return (r );
@@ -1931,7 +1935,7 @@ rc_utimes(hctransaction_t trans, struct HCHead *head)
19311935 struct timeval times [2 ];
19321936 const char * path ;
19331937
1934- bzero (times , sizeof (times ));
1938+ memset (times , 0 , sizeof (times ));
19351939 path = NULL ;
19361940
19371941 FOR_EACH_ITEM (item , trans , head ) {
0 commit comments