Skip to content

Commit 4dfa411

Browse files
Adam Farleyshipilev
Adam Farley
authored andcommittedOct 7, 2020
8252997: Null-proofing for linker_md.c
Reviewed-by: sspitsyn
1 parent 97ff38c commit 4dfa411

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎src/jdk.jdwp.agent/unix/native/libjdwp/linker_md.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
4949
*buffer = '\0';
5050

5151
paths_copy = jvmtiAllocate((int)strlen(paths) + 1);
52-
strcpy(paths_copy, paths);
5352
if (paths_copy == NULL) {
5453
return;
5554
}
5655

56+
strcpy(paths_copy, paths);
57+
5758
next_token = NULL;
5859
path = strtok_r(paths_copy, PATH_SEPARATOR, &next_token);
5960

‎src/jdk.jdwp.agent/windows/native/libjdwp/linker_md.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
4646
*buffer = '\0';
4747

4848
paths_copy = jvmtiAllocate((int)strlen(paths) + 1);
49-
strcpy(paths_copy, paths);
5049
if (paths_copy == NULL) {
5150
return;
5251
}
5352

53+
strcpy(paths_copy, paths);
54+
5455
next_token = NULL;
5556
path = strtok_s(paths_copy, PATH_SEPARATOR, &next_token);
5657

0 commit comments

Comments
 (0)
Please sign in to comment.