]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add few more checks to bsnprintf()
authorEric Bollengier <eric@baculasystems.com>
Wed, 7 Apr 2021 13:46:42 +0000 (15:46 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
bacula/src/lib/bsnprintf.c

index 0360220ae6674ca5aabf516402452127f07b1445..f7d665083f7d467c0027450be6e5d164499714d7 100644 (file)
@@ -863,6 +863,7 @@ int main(int argc, char *argv[])
    char msg[MSGLEN];
    bool check_cont, check_nr;
    int pcount, bcount;
+   bsnprintf_test.set_nb_tests(141);
 
 #ifdef FP_OUTPUT
    const char *fp_fmt[] = {
@@ -1075,6 +1076,13 @@ int main(int argc, char *argv[])
    is (strlen(buf1), 9, "Checking the return code against strlen()");
    is (bcount, 10, "Checking the return code of sprintf()");
    is (bcount, pcount, "Checking difference between bsnprintf() and snprintf()");
+
+   log("Testing Mmsg() with bsnprintf count issue");
+   POOLMEM *p = get_memory(10);
+   is (sizeof_pool_memory(p), 10, "check POOLMEM size with get_memory()");
+   Mmsg(p, "This is a format with a number %d", 1);
+   is (32, strlen(p), "check Mmsg overflow");
+   free_pool_memory(p);
    return report();
 }
 #endif /* TEST_PROGRAM */