]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Fix wrong fscanf usage on tst-pldd
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 25 Mar 2022 14:16:49 +0000 (11:16 -0300)
committerArjun Shankar <arjun@redhat.com>
Fri, 25 Nov 2022 14:16:00 +0000 (15:16 +0100)
To take in consideration the extra '\0'.

Checked on x86_64-linux-gnu.

(cherry picked from commit b2cd93fce666fdc8c9a5c64af2741a8a6940ac99)

elf/tst-pldd.c

index f31f9956faad786541025482f4dbf35919be661d..8916ce5a2e006348941c3b42a1ff803dbc6c270a 100644 (file)
@@ -113,7 +113,8 @@ do_test (void)
     TEST_VERIFY (out != NULL);
 
     /* First line is in the form of <pid>: <full path of executable>  */
-    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);