[COMMITTED] elf: Fix wrong fscanf usage on tst-pldd

Message ID 20220331115911.55027-1-adhemerval.zanella@linaro.org
State Committed
Commit b2cd93fce666fdc8c9a5c64af2741a8a6940ac99
Headers
Series [COMMITTED] elf: Fix wrong fscanf usage on tst-pldd |

Commit Message

Adhemerval Zanella Netto March 31, 2022, 11:59 a.m. UTC
  To take in consideration the extra '\0'.

Checked on x86_64-linux-gnu.
---
 elf/tst-pldd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c
index f31f9956fa..8916ce5a2e 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 <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);