From: Adhemerval Zanella Date: Fri, 25 Mar 2022 14:16:49 +0000 (-0300) Subject: elf: Fix wrong fscanf usage on tst-pldd X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2636fbb7efa8ba6ee101fa64f2295e5f118b8d96;p=thirdparty%2Fglibc.git elf: Fix wrong fscanf usage on tst-pldd To take in consideration the extra '\0'. Checked on x86_64-linux-gnu. (cherry picked from commit b2cd93fce666fdc8c9a5c64af2741a8a6940ac99) --- diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c index f31f9956faa..8916ce5a2e0 100644 --- a/elf/tst-pldd.c +++ b/elf/tst-pldd.c @@ -113,7 +113,8 @@ do_test (void) TEST_VERIFY (out != NULL); /* First line is in the form of : */ - TEST_COMPARE (fscanf (out, "%u: " STRINPUT (512), &pid, buffer), 2); + TEST_COMPARE (fscanf (out, "%u: " STRINPUT (sizeof (buffer) - 1), &pid, + buffer), 2); TEST_COMPARE (pid, *target_pid_ptr); TEST_COMPARE (strcmp (basename (buffer), "tst-pldd"), 0);