This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/60548] New: [libvtv/scripts/sum-vtv-counts.c:108]: (warning) scanf without field width limit s can crash with huge input data.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60548

            Bug ID: 60548
           Summary: [libvtv/scripts/sum-vtv-counts.c:108]: (warning) scanf
                    without field width limit s can crash with huge input
                    data.
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

Source code is

  while (fscanf (fp_in, "%s %d %d %d %d %d\n", fname_in,  &total,
         &verified, &regset, &regpair, &unused) != EOF)

but

  char fname_in[1024];

Maybe better code might be

  while (fscanf (fp_in, "%1024s %d %d %d %d %d\n", fname_in,  &total,
         &verified, &regset, &regpair, &unused) != EOF)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]