From: Eric Bollengier Date: Wed, 7 Apr 2021 13:50:45 +0000 (+0200) Subject: regress: Revert code to detect overflow in bstring X-Git-Tag: Release-11.3.2~603 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b3048b793d8c2dd3f32bb6816a91d1f97dfcff;p=thirdparty%2Fbacula.git regress: Revert code to detect overflow in bstring --- diff --git a/bacula/src/lib/unittests.c b/bacula/src/lib/unittests.c index e4db70c5c..1f6b1d6db 100644 --- a/bacula/src/lib/unittests.c +++ b/bacula/src/lib/unittests.c @@ -244,12 +244,12 @@ int report() /* We do not count the extra expected check in the display */ int nb_ok = nb - err; int nb_total = nb; - Pmsg0(-1, "==== Report ====\n"); + Pmsg0(-1, "\n==== Report ====\n"); /* Do an extra check if the expected variable is set */ if (expected > 0) { is(nb, expected, "Checking expected tests number"); } - Pmsg2(-1, "Result %i/%i OK\n", nb_ok, nb_total); + Pmsg3(-1, "Result %i/%i OK%s\n", nb_ok, nb_total, (err > 0) ? "!!!":""); return err > 0; } diff --git a/bacula/src/lib/unittests.h b/bacula/src/lib/unittests.h index f1e3e2723..402e87324 100644 --- a/bacula/src/lib/unittests.h +++ b/bacula/src/lib/unittests.h @@ -119,10 +119,9 @@ public: for (;;) { maxlen = this->max_size() - 1; va_start(arg_ptr, fmt); - bvsnprintf(this->c_str(), maxlen, fmt, arg_ptr); - len = strlen(this->c_str()); + len = bvsnprintf(this->c_str(), maxlen, fmt, arg_ptr); va_end(arg_ptr); - if (len >= (maxlen - 5)) { // Was truncated, need to resize + if (len < 0 || len >= (maxlen - 5)) { this->realloc_pm(maxlen + maxlen/2); continue; }