From 0813c1e95e4831c030398f187184b100bfc1b3d9 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 27 Dec 2021 14:31:15 +0000 Subject: [PATCH] Fix off-by-one in blob download, where in the case that the blob is evenly divisible by 1400, the last chunk isn't marked with an end flag. ok tobhe@ --- sys/dev/ic/bwfm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 8b08d4cb2c3..23c3bb50f9a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.96 2021/12/27 14:28:13 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.97 2021/12/27 14:31:15 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -2993,7 +2993,7 @@ bwfm_process_blob(struct bwfm_softc *sc, char *var, u_char **blob, data->flag = htole16(BWFM_DLOAD_FLAG_HANDLER_VER_1); if (off == 0) data->flag |= htole16(BWFM_DLOAD_FLAG_BEGIN); - if (remain < BWFM_DLOAD_MAX_LEN) + if (remain <= BWFM_DLOAD_MAX_LEN) data->flag |= htole16(BWFM_DLOAD_FLAG_END); data->type = htole16(BWFM_DLOAD_TYPE_CLM); data->len = htole32(len); -- 2.20.1