Use ibuf_data() instead of accessing ibuf->buf directly.
authorclaudio <claudio@openbsd.org>
Mon, 3 Jul 2023 09:38:08 +0000 (09:38 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 3 Jul 2023 09:38:08 +0000 (09:38 +0000)
OK tb@

usr.sbin/relayd/check_tcp.c
usr.sbin/relayd/check_tls.c
usr.sbin/relayd/parse.y

index 9bcb40f..4f6ded9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: check_tcp.c,v 1.60 2023/06/21 07:54:54 claudio Exp $  */
+/*     $OpenBSD: check_tcp.c,v 1.61 2023/07/03 09:38:08 claudio Exp $  */
 
 /*
  * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -214,7 +214,7 @@ tcp_send_req(int s, short event, void *arg)
                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 *cte)
                /*
                 * 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 3fe8291..04df503 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: check_tls.c,v 1.2 2019/09/15 19:23:29 rob Exp $       */
+/*     $OpenBSD: check_tls.c,v 1.3 2023/07/03 09:38:08 claudio Exp $   */
 
 /*
  * Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org>
@@ -104,10 +104,10 @@ check_tls_write(int s, short event, void *arg)
 
        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 22beb85..a1250de 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.253 2021/10/15 15:01:28 naddy Exp $       */
+/*     $OpenBSD: parse.y,v 1.254 2023/07/03 09:38:08 claudio Exp $     */
 
 /*
  * Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -996,7 +996,7 @@ tablecheck  : ICMP                  { table->conf.check = CHECK_ICMP; }
                                free($5);
                                YYERROR;
                        }
-                       memcpy(table->conf.exbinbuf, ibuf->buf,
+                       memcpy(table->conf.exbinbuf, ibuf_data(ibuf),
                            ibuf_size(ibuf));
                        ibuf_free(ibuf);
                        free($5);