Skip to content

Commit

Permalink
8307848: update for deprecated sprintf for jdk.attach
Browse files Browse the repository at this point in the history
Reviewed-by: sspitsyn, cjplummer
  • Loading branch information
XueleiFan committed May 11, 2023
1 parent cbecf42 commit 1535863
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, 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 @@ -209,7 +209,7 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_openProcess
} else {
char err_mesg[255];
/* include the last error in the default detail message */
sprintf(err_mesg, "OpenProcess(pid=%d) failed; LastError=0x%x",
snprintf(err_mesg, sizeof(err_mesg), "OpenProcess(pid=%d) failed; LastError=0x%x",
(int)pid, (int)GetLastError());
JNU_ThrowIOExceptionWithLastError(env, err_mesg);
}
Expand Down Expand Up @@ -492,7 +492,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue
break;
default : {
char errmsg[128];
sprintf(errmsg, "Remote thread failed for unknown reason (%d)", exitCode);
snprintf(errmsg, sizeof(errmsg), "Remote thread failed for unknown reason (%d)", exitCode);
JNU_ThrowInternalError(env, errmsg);
}
}
Expand Down

1 comment on commit 1535863

@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.