Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8252051: Make mlvmJvmtiUtils strncpy uses GCC 10.x friendly
Browse files Browse the repository at this point in the history
Backport-of: 51a3b25
  • Loading branch information
Yuri Nesterenko committed Sep 9, 2022
1 parent 29b5ddc commit 6ce4b72
Showing 1 changed file with 6 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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
Expand Down Expand Up @@ -96,8 +96,11 @@ struct MethodName * getMethodName(jvmtiEnv * pJvmtiEnv, jmethodID method) {
return NULL;
}

strncpy(mn->methodName, szName, sizeof(mn->methodName));
strncpy(mn->classSig, szSignature, sizeof(mn->classSig));
strncpy(mn->methodName, szName, sizeof(mn->methodName) - 1);
mn->methodName[sizeof(mn->methodName) - 1] = '\0';

strncpy(mn->classSig, szSignature, sizeof(mn->classSig) - 1);
mn->classSig[sizeof(mn->classSig) - 1] = '\0';

return mn;
}
Expand Down

1 comment on commit 6ce4b72

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.