Fix potential stack overflow [BZ #23490]
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Sat, 8 Dec 2018 18:46:59 +0000 (10:46 -0800)
committerPaul Pluzhnikov <ppluzhnikov@google.com>
Sat, 8 Dec 2018 18:51:36 +0000 (10:51 -0800)
Since we are expecting the exact "IBT" string, adjust stack buffer size
and scanf format accordingly.

ChangeLog
sysdeps/unix/sysv/linux/x86/tst-cet-property-2.c

index 7c4b061..03cbe04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-08  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       [BZ #23490]
+       * sysdeps/unix/sysv/linux/x86/tst-cet-property-2.c
+       (do_test): Adjust buffer size and fix format.
+
 2018-12-07  DJ Delorie  <dj@redhat.com>
 
        [BZ #23907]
index 0531074..259ef44 100644 (file)
@@ -44,9 +44,9 @@ sig_handler (int signo)
 static int
 do_test (void)
 {
-  char buf[20];
+  char buf[4];
 
-  if (scanf ("%20s", buf) != 1)
+  if (scanf ("%3s", buf) != 1)
     FAIL_UNSUPPORTED ("IBT not supported");
 
   if (strcmp (buf, "IBT") != 0)