This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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 sim/18273] sim: various cppcheck warnings


https://sourceware.org/bugzilla/show_bug.cgi?id=18273

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vapier at gentoo dot org
          Component|binutils                    |sim
            Version|2.26 (HEAD)                 |HEAD
           Assignee|unassigned at sourceware dot org   |vapier at gentoo dot org
            Product|binutils                    |gdb
   Target Milestone|---                         |8.0
            Summary|cppcheck meets sim - five   |sim: various cppcheck
                   |bugs                        |warnings

--- Comment #1 from Mike Frysinger <vapier at gentoo dot org> ---
David Binderman also mentioned this warning:

[src/sim/common/sim-trace.c:1229]: (error) Dangerous usage of 'phase' (strncpy
doesn't always null-terminate it).

Source code is

  strncpy (phase, phase_wo_colon, SIZE_PHASE);
  strcat (phase, ":");

It might be worthwhile to make sure the string is always terminated.
Something like

  strncpy (phase, phase_wo_colon, SIZE_PHASE);
  phase[SIZE_PHASE-1] = '\0';
  strcat (phase, ":");

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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