On Mon, Jul 03, 2023 at 11:26:34AM +0200, Claudio Jeker wrote:
> This is just some additional ibuf cleanup in relayd.
> Mostly use ibuf_data() instead of direct access to ibuf->buf.

ok tb

> 
> -- 
> :wq Claudio
> 
> Index: check_tcp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
> retrieving revision 1.60
> diff -u -p -r1.60 check_tcp.c
> --- check_tcp.c       21 Jun 2023 07:54:54 -0000      1.60
> +++ check_tcp.c       30 Jun 2023 08:52:36 -0000
> @@ -214,7 +214,7 @@ tcp_send_req(int s, short event, void *a
>               req = ibuf_data(cte->table->sendbinbuf);
>               log_debug("%s: table %s sending binary", __func__,
>                   cte->table->conf.name);
> -             print_hex(cte->table->sendbinbuf->buf, 0, len);
> +             print_hex(req, 0, len);
>       } else {
>               len = strlen(cte->table->sendbuf);
>               req = cte->table->sendbuf;
> @@ -323,7 +323,7 @@ check_send_expect(struct ctl_tcp_event *
>               /*
>                * ensure string is nul-terminated.
>                */
> -             b = strndup(cte->buf->buf, ibuf_size(cte->buf));
> +             b = strndup(ibuf_data(cte->buf), ibuf_size(cte->buf));
>               if (b == NULL)
>                       fatal("out of memory");
>               if (fnmatch(cte->table->conf.exbuf, b, 0) == 0) {
> Index: check_tls.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/check_tls.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 check_tls.c
> --- check_tls.c       15 Sep 2019 19:23:29 -0000      1.2
> +++ check_tls.c       3 Sep 2021 15:58:41 -0000
> @@ -104,10 +104,10 @@ check_tls_write(int s, short event, void
>  
>       if (cte->table->sendbinbuf != NULL) {
>               len = ibuf_size(cte->table->sendbinbuf);
> -             buf = cte->table->sendbinbuf->buf;
> +             buf = ibuf_data(cte->table->sendbinbuf);
>               log_debug("%s: table %s sending binary", __func__,
>                   cte->table->conf.name);
> -             print_hex(cte->table->sendbinbuf->buf, 0, len);
> +             print_hex(buf, 0, len);
>       } else {
>               len = strlen(cte->table->sendbuf);
>               buf = cte->table->sendbuf;
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/parse.y,v
> retrieving revision 1.253
> diff -u -p -r1.253 parse.y
> --- parse.y   15 Oct 2021 15:01:28 -0000      1.253
> +++ parse.y   23 Oct 2021 15:16:33 -0000
> @@ -996,7 +996,7 @@ tablecheck        : ICMP                  { 
> table->conf.check 
>                               free($5);
>                               YYERROR;
>                       }
> -                     memcpy(table->conf.exbinbuf, ibuf->buf,
> +                     memcpy(table->conf.exbinbuf, ibuf_data(ibuf),
>                           ibuf_size(ibuf));
>                       ibuf_free(ibuf);
>                       free($5);
> 

Reply via email to