8252997: Null-proofing for linker_md.c

Reviewed-by: sspitsyn
This commit is contained in:
Adam Farley 2020-10-07 08:05:27 +00:00 committed by Aleksey Shipilev
parent 97ff38caff
commit 4dfa411247
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -49,11 +49,12 @@ static void dll_build_name(char* buffer, size_t buflen,
*buffer = '\0';
paths_copy = jvmtiAllocate((int)strlen(paths) + 1);
strcpy(paths_copy, paths);
if (paths_copy == NULL) {
return;
}
strcpy(paths_copy, paths);
next_token = NULL;
path = strtok_r(paths_copy, PATH_SEPARATOR, &next_token);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -46,11 +46,12 @@ static void dll_build_name(char* buffer, size_t buflen,
*buffer = '\0';
paths_copy = jvmtiAllocate((int)strlen(paths) + 1);
strcpy(paths_copy, paths);
if (paths_copy == NULL) {
return;
}
strcpy(paths_copy, paths);
next_token = NULL;
path = strtok_s(paths_copy, PATH_SEPARATOR, &next_token);