RFR(xs): 8076475: Misuses of strncpy/strncat

Thomas Stüfe thomas.stuefe at gmail.com
Wed Apr 8 08:09:45 UTC 2015


Hi,

please review these small fixes around use of strncpy/strncat.

Bug report: https://bugs.openjdk.java.net/browse/JDK-8076475
Webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8076475/webrev.00/webrev/

Changes in detail are:

agent/src/os/bsd/libproc_impl.c
agent/src/os/linux/libproc_impl.c:
                - missing \0 on truncation. Replaced with snprintf, add
truncation handling

src/os/bsd/dtrace/libjvm_db.c
src/os/solaris/dtrace/libjvm_db.c
                @@ -580,17 +580,18 @@
                - overwrite on truncation
                @@ -1093,13 +1094,13 @@
                - overwrite on truncation

src/share/vm/compiler/compileBroker.hpp
                - missing \0 on truncation.

src/share/tools/hsdis/hsdis.c
                - missing \0

src/os/bsd/vm/decoder_machO.cpp
                - missing \0 on truncation.

src/share/vm/compiler/compilerOracle.cpp
                - Replaced with jio_snprintf, less awkward and does not
restrict each part to 255 chars each.

src/share/vm/compiler/disassembler.cpp
                - missing \0 on truncation.

src/share/vm/runtime/arguments.cpp
                @@ -2703,11 +2703,11 @@
                - replaced with strdup, easier to read
                @@ -3294,12 +3294,11 @@
                - the same
                @@ -3627,18 +3626,14 @@
                - replace strncpy/strncat sequence with jio_snprintf -
easier to read.
                - replace malloc/strncpy with os::strdup

src/share/vm/utilities/ostream.cpp
                - avoid \0 padding

src/share/vm/utilities/vmError.cp
                @@ -219,7 +219,7 @@
                - avoid \0 padding
                @@ -463,14 +463,7 @@
                - simplified

Kind regards, Thomas


More information about the hotspot-runtime-dev mailing list