[time] Guard against format string ending with bare %

This commit is contained in:
J. Nick Koston
2026-03-30 22:15:34 -10:00
parent d0d8f2935d
commit 5d93713404
+1 -1
View File
@@ -24,7 +24,7 @@ size_t ESPTime::strftime(char *buffer, size_t buffer_len, const char *format) {
// Quick scan: does format contain %Z or %z (but not %%Z/%%z)?
bool needs_subst = false;
for (const char *p = format; *p; p++) {
if (*p == '%') {
if (*p == '%' && *(p + 1)) {
p++;
if (*p == '%')
continue; // %% is a literal %, skip