From f5eeef4710c3a96ea3eac0d392c257502d3b193e Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 3 Jun 2020 22:32:20 -0500 Subject: [PATCH] Bugfix: correctly calculate terminating null for fl_string_dynamic_terminate_after() --- level_1/fl_string/c/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 7b2614f..0a47988 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -1070,8 +1070,8 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (destination->used > 0) { - for (f_string_length i = destination->used; i > 0; i--, destination->used--) { - if (destination->string[i] == 0) continue; + for (; destination->used > 0; destination->used--) { + if (destination->string[destination->used - 1] == 0) continue; break; } // for } -- 1.8.3.1