From a0b2d3d80eab5d108f52cf1ec1cc467f4db30cb4 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 13 Jan 2022 22:30:20 +0000 Subject: [PATCH] Check return value of eth_send in case of errors --- nse_dnet.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nse_dnet.cc b/nse_dnet.cc index 51bf57538..73a323409 100644 --- a/nse_dnet.cc +++ b/nse_dnet.cc @@ -206,8 +206,11 @@ static int ethernet_send (lua_State *L) log_write(LOG_STDOUT, "%s: Ethernet frame (%lu bytes) > %s\n", SCRIPT_ENGINE, len, udata->devname); } - eth_send(udata->eth, frame, len); - return nseU_success(L); + size_t sent = eth_send(udata->eth, frame, len); + if (sent == len) + return nseU_success(L); + else + return nseU_safeerror(L, "eth_send error: %lu", sent); } static int ip_open (lua_State *L)