Mercurial > hg > truffle
comparison src/os/solaris/vm/os_solaris.cpp @ 17567:5656140324ed
8030763: Validate global memory allocation
Summary: Add length checks where necessary
Reviewed-by: coleenp, mschoene
author | hseigel |
---|---|
date | Thu, 13 Feb 2014 11:28:17 -0500 |
parents | 40136aa2cdb1 |
children | 3eed8712d410 364b73402247 |
comparison
equal
deleted
inserted
replaced
17566:bf4dc2e29b5c | 17567:5656140324ed |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
1786 // Die immediately, no exit hook, no abort hook, no cleanup. | 1786 // Die immediately, no exit hook, no abort hook, no cleanup. |
1787 void os::die() { | 1787 void os::die() { |
1788 ::abort(); // dump core (for debugging) | 1788 ::abort(); // dump core (for debugging) |
1789 } | 1789 } |
1790 | 1790 |
1791 // unused | |
1792 void os::set_error_file(const char *logfile) {} | |
1793 | |
1794 // DLL functions | 1791 // DLL functions |
1795 | 1792 |
1796 const char* os::dll_file_extension() { return ".so"; } | 1793 const char* os::dll_file_extension() { return ".so"; } |
1797 | 1794 |
1798 // This must be hard coded because it's the system's temporary | 1795 // This must be hard coded because it's the system's temporary |
2472 | 2469 |
2473 realpath(java_home_var, buf); | 2470 realpath(java_home_var, buf); |
2474 // determine if this is a legacy image or modules image | 2471 // determine if this is a legacy image or modules image |
2475 // modules image doesn't have "jre" subdirectory | 2472 // modules image doesn't have "jre" subdirectory |
2476 len = strlen(buf); | 2473 len = strlen(buf); |
2474 assert(len < buflen, "Ran out of buffer space"); | |
2477 jrelib_p = buf + len; | 2475 jrelib_p = buf + len; |
2478 snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); | 2476 snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); |
2479 if (0 != access(buf, F_OK)) { | 2477 if (0 != access(buf, F_OK)) { |
2480 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); | 2478 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
2481 } | 2479 } |
2490 } | 2488 } |
2491 } | 2489 } |
2492 } | 2490 } |
2493 } | 2491 } |
2494 | 2492 |
2495 strcpy(saved_jvm_path, buf); | 2493 strncpy(saved_jvm_path, buf, MAXPATHLEN); |
2496 } | 2494 } |
2497 | 2495 |
2498 | 2496 |
2499 void os::print_jni_name_prefix_on(outputStream* st, int args_size) { | 2497 void os::print_jni_name_prefix_on(outputStream* st, int args_size) { |
2500 // no prefix required, not even "_" | 2498 // no prefix required, not even "_" |