Mercurial > hg > graal-jvmci-8
comparison src/os/linux/vm/os_linux.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 | e4f478e7781b |
children | 3eed8712d410 364b73402247 |
comparison
equal
deleted
inserted
replaced
17566:bf4dc2e29b5c | 17567:5656140324ed |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 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. |
1570 void os::die() { | 1570 void os::die() { |
1571 // _exit() on LinuxThreads only kills current thread | 1571 // _exit() on LinuxThreads only kills current thread |
1572 ::abort(); | 1572 ::abort(); |
1573 } | 1573 } |
1574 | 1574 |
1575 // unused on linux for now. | |
1576 void os::set_error_file(const char *logfile) {} | |
1577 | |
1578 | 1575 |
1579 // This method is a copy of JDK's sysGetLastErrorString | 1576 // This method is a copy of JDK's sysGetLastErrorString |
1580 // from src/solaris/hpi/src/system_md.c | 1577 // from src/solaris/hpi/src/system_md.c |
1581 | 1578 |
1582 size_t os::lasterror(char *buf, size_t len) { | 1579 size_t os::lasterror(char *buf, size_t len) { |
2397 return; | 2394 return; |
2398 | 2395 |
2399 // determine if this is a legacy image or modules image | 2396 // determine if this is a legacy image or modules image |
2400 // modules image doesn't have "jre" subdirectory | 2397 // modules image doesn't have "jre" subdirectory |
2401 len = strlen(buf); | 2398 len = strlen(buf); |
2399 assert(len < buflen, "Ran out of buffer room"); | |
2402 jrelib_p = buf + len; | 2400 jrelib_p = buf + len; |
2403 snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); | 2401 snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); |
2404 if (0 != access(buf, F_OK)) { | 2402 if (0 != access(buf, F_OK)) { |
2405 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); | 2403 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
2406 } | 2404 } |
2417 } | 2415 } |
2418 } | 2416 } |
2419 } | 2417 } |
2420 } | 2418 } |
2421 | 2419 |
2422 strcpy(saved_jvm_path, buf); | 2420 strncpy(saved_jvm_path, buf, MAXPATHLEN); |
2423 } | 2421 } |
2424 | 2422 |
2425 void os::print_jni_name_prefix_on(outputStream* st, int args_size) { | 2423 void os::print_jni_name_prefix_on(outputStream* st, int args_size) { |
2426 // no prefix required, not even "_" | 2424 // no prefix required, not even "_" |
2427 } | 2425 } |