From: claudio Date: Mon, 3 Jul 2023 09:38:08 +0000 (+0000) Subject: Use ibuf_data() instead of accessing ibuf->buf directly. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bce5c5dd5876dac2dfbb4bd059ebdd08dffa9478;p=openbsd Use ibuf_data() instead of accessing ibuf->buf directly. OK tb@ --- diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c index 9bcb40ff998..4f6ded93507 100644 --- a/usr.sbin/relayd/check_tcp.c +++ b/usr.sbin/relayd/check_tcp.c @@ -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 @@ -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) { diff --git a/usr.sbin/relayd/check_tls.c b/usr.sbin/relayd/check_tls.c index 3fe829101f7..04df50308b0 100644 --- a/usr.sbin/relayd/check_tls.c +++ b/usr.sbin/relayd/check_tls.c @@ -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 @@ -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; diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 22beb857229..a1250de51aa 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -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 @@ -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);