On Thu, Aug 25, 2022 at 05:31:55PM +0200, Claudio Jeker wrote:
> The same change was done in bgpd and bgpctl. So here is bgplgd.
> I replaced one bcopy() with memmove() since this is most probably an
> overlapping memory move.

Agreed, that looks like it could be overlapping.

ok

> 
> -- 
> :wq Claudio
> 
> Index: qs.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgplgd/qs.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 qs.c
> --- qs.c      28 Jun 2022 16:11:30 -0000      1.1
> +++ qs.c      17 Aug 2022 15:17:27 -0000
> @@ -148,7 +148,7 @@ valid_prefix(char *str)
>               p[0] = '\0';
>       }
>  
> -     bzero(&hints, sizeof(hints));
> +     memset(&hints, 0, sizeof(hints));
>       hints.ai_family = AF_UNSPEC;
>       hints.ai_socktype = SOCK_DGRAM;
>       hints.ai_flags = AI_NUMERICHOST;
> Index: slowcgi.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgplgd/slowcgi.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 slowcgi.c
> --- slowcgi.c 12 Aug 2022 13:24:30 -0000      1.3
> +++ slowcgi.c 17 Aug 2022 15:18:50 -0000
> @@ -387,7 +387,7 @@ slowcgi_listen(char *path, struct passwd
>           0)) == -1)
>               lerr(1, "slowcgi_listen: socket");
>  
> -     bzero(&sun, sizeof(sun));
> +     memset(&sun, 0, sizeof(sun));
>       sun.sun_family = AF_UNIX;
>       if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
>           sizeof(sun.sun_path))
> @@ -681,7 +681,7 @@ slowcgi_request(int fd, short events, vo
>  
>       /* Make space for further reads */
>       if (c->buf_len > 0) {
> -             bcopy(c->buf + c->buf_pos, c->buf, c->buf_len);
> +             memmove(c->buf, c->buf + c->buf_pos, c->buf_len);
>               c->buf_pos = 0;
>       }
>       return;
> @@ -789,11 +789,11 @@ parse_params(uint8_t *buf, uint16_t n, s
>                       return;
>               }
>  
> -             bcopy(buf, env_entry->key, name_len);
> +             memcpy(env_entry->key, buf, name_len);
>               buf += name_len;
>               n -= name_len;
>               env_entry->key[name_len] = '\0';
> -             bcopy(buf, env_entry->val, val_len);
> +             memcpy(env_entry->val, buf, val_len);
>               buf += val_len;
>               n -= val_len;
>               env_entry->val[val_len] = '\0';
> 

Reply via email to