From ea99e4724f9e7f6eaa9b267d6081c35b5e1fcf06 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:10:20 +0200 Subject: [PATCH] Autoconf failing when last line has no trailing LF (#23537) --- CHANGELOG.md | 1 + lib/libesp32/berry_tasmota/src/be_port.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b3d112d..1e01ae304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ All notable changes to this project will be documented in this file. - Berry avoid json parsing for unmatched commands (#23494) - Berry integer and real parser to handle overflows (#23495) - Berry potential pointer underflow with `string.endswith` (#23496) +- Autoconf failing when last line has no trailing LF ### Removed diff --git a/lib/libesp32/berry_tasmota/src/be_port.cpp b/lib/libesp32/berry_tasmota/src/be_port.cpp index c07200b2d..300c6de00 100644 --- a/lib/libesp32/berry_tasmota/src/be_port.cpp +++ b/lib/libesp32/berry_tasmota/src/be_port.cpp @@ -319,7 +319,7 @@ char* be_fgets(void *hfile, void *buffer, int size) // Serial.printf("be_fgets size=%d ret=%d\n", size, ret); if (ret >= 0) { buf[ret] = 0; // add string terminator - if (ret < size - 1) { + if ((ret != 0) && (ret < size - 1)) { buf[ret] = '\n'; buf[ret+1] = 0; }