]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Revert code to detect overflow in bstring
authorEric Bollengier <eric@baculasystems.com>
Wed, 7 Apr 2021 13:50:45 +0000 (15:50 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
bacula/src/lib/unittests.c
bacula/src/lib/unittests.h

index e4db70c5c8492f2e347cc94095a91cb71e406fdc..1f6b1d6dbe438d4e64d43f31edf1a2e24efe534f 100644 (file)
@@ -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;
 }
 
index f1e3e2723f2547d206df76bdd8a404c520d8a828..402e873247bd95a315cbe6a74713673299a6a08e 100644 (file)
@@ -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;
          }