OpenJDK / portola / portola
changeset 47651:148b73047771
8175510: Null pointer dereference in getModuleObject of JPLISAgent.c:790
Summary: Check for NULL pointer return from malloc
Reviewed-by: dholmes, cjplummer
author | sspitsyn |
---|---|
date | Wed, 18 Oct 2017 13:52:32 -0700 |
parents | 5fbb4e3b5c92 |
children | 6de1ff734cf1 e362049c1cb8 |
files | src/java.instrument/share/native/libinstrument/JPLISAgent.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/java.instrument/share/native/libinstrument/JPLISAgent.c Tue Oct 17 14:37:01 2017 -0700 +++ b/src/java.instrument/share/native/libinstrument/JPLISAgent.c Wed Oct 18 13:52:32 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -783,7 +783,10 @@ int len = (last_slash == NULL) ? 0 : (int)(last_slash - cname); char* pkg_name_buf = (char*)malloc(len + 1); - jplis_assert_msg(pkg_name_buf != NULL, "OOM error in native tmp buffer allocation"); + if (pkg_name_buf == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } if (last_slash != NULL) { strncpy(pkg_name_buf, cname, len); }