RFR: 8074895: os::getenv is inadequate

David Holmes david.holmes at oracle.com
Wed Mar 18 21:39:00 UTC 2015


On 19/03/2015 3:04 AM, Jeremy Manson wrote:
> Okay.  Here you go:
>
> http://cr.openjdk.java.net/~jmanson/8074895/webrev.03/index.html

!     if (alt_home_dir != NULL)  {
!       strcpy(home_dir, alt_home_dir);
!     } else {

That needs to be strncpy limited by MAX_PATH.

David

> Jeremy
>
> On Wed, Mar 18, 2015 at 12:31 AM, David Holmes <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>> wrote:
>
>     On 18/03/2015 4:15 PM, Jeremy Manson wrote:
>
>         Oops...  Should I fix it, post a patch, and hope it compiles?
>
>
>     Please :) I can check the compiles part.
>
>     David
>
>         On Tue, Mar 17, 2015 at 9:09 PM, David Holmes
>         <david.holmes at oracle.com <mailto:david.holmes at oracle.com>
>         <mailto:david.holmes at oracle.__com
>         <mailto:david.holmes at oracle.com>>> wrote:
>
>              Sorry Jeremy, the patch failed on Windows as there is
>         another usage
>              in os_windows.cpp:
>
>              void os::init_system_properties_____values() {
>                 // sysclasspath, java_home, dll_dir
>                 {
>                   char *home_path;
>                   char *dll_path;
>                   char *pslash;
>                   char *bin = "\\bin";
>                   char home_dir[MAX_PATH];
>
>                   if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {
>
>              David
>
>
>              On 18/03/2015 12:01 PM, David Holmes wrote:
>
>                  Submitting via JPRT.
>
>                  Thanks,
>                  David
>
>                  On 18/03/2015 4:13 AM, Jeremy Manson wrote:
>
>
>
>                      On Sun, Mar 15, 2015 at 10:04 PM, David Holmes
>                      <david.holmes at oracle.com
>         <mailto:david.holmes at oracle.com>
>         <mailto:david.holmes at oracle.__com <mailto:david.holmes at oracle.com>>
>                      <mailto:david.holmes at oracle.
>         <mailto:david.holmes at oracle.>____com
>                      <mailto:david.holmes at oracle.__com
>         <mailto:david.holmes at oracle.com>>>> wrote:
>
>                           Hi Jeremy,
>
>                           On 14/03/2015 3:00 AM, Jeremy Manson wrote:
>
>                               Thanks, David!  New rev:
>
>         http://cr.openjdk.java.net/~______jmanson/8074895/webrev.01/
>         <http://cr.openjdk.java.net/~____jmanson/8074895/webrev.01/>
>
>         <http://cr.openjdk.java.net/~____jmanson/8074895/webrev.01/
>         <http://cr.openjdk.java.net/~__jmanson/8074895/webrev.01/>>
>
>
>         <http://cr.openjdk.java.net/~____jmanson/8074895/webrev.01/
>         <http://cr.openjdk.java.net/~__jmanson/8074895/webrev.01/>
>
>         <http://cr.openjdk.java.net/~__jmanson/8074895/webrev.01/
>         <http://cr.openjdk.java.net/~jmanson/8074895/webrev.01/>>>
>
>
>                           Looks good. Please update copyright dates in
>                      memTracker.cpp and
>                           vmError.cpp.
>
>
>                      Done.  Thanks for the review, and for feeding it
>         through the
>                      other
>                      platforms!
>
>         http://cr.openjdk.java.net/~____jmanson/8074895/webrev.02/
>         <http://cr.openjdk.java.net/~__jmanson/8074895/webrev.02/>
>
>         <http://cr.openjdk.java.net/~__jmanson/8074895/webrev.02/
>         <http://cr.openjdk.java.net/~jmanson/8074895/webrev.02/>>
>
>                      Jeremy
>
>
>


More information about the hotspot-runtime-dev mailing list