Skip to content

Commit

Permalink
8301132: Test update for deprecated sprintf in Xcode 14
Browse files Browse the repository at this point in the history
Reviewed-by: mikael
  • Loading branch information
XueleiFan committed Jan 27, 2023
1 parent 7f05d57 commit 9c4bc2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions test/jdk/sun/management/jmxremote/bootstrap/exelauncher.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ int main(int argc, char**argv) {
fprintf(stderr, "Usage: %s jvm-path classpath class\n", argv[0]);
return -1;
}
cp_prop = (char*)malloc(strlen(CP_PROP)+strlen(argv[2]) +1);
sprintf(cp_prop, "%s%s", CP_PROP, argv[2]);
size_t propLen = strlen(CP_PROP) + strlen(argv[2]) + 1;
cp_prop = (char*)malloc(propLen);
snprintf(cp_prop, propLen, "%s%s", CP_PROP, argv[2]);

options[0].optionString = cp_prop;
vm_args.version = 0x00010002;
Expand Down
9 changes: 5 additions & 4 deletions test/jdk/sun/management/windows/exerevokeall.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ static char *getTextualSid(SID* sid) {
}

// S-SID_REVISION
sprintf(name, "S-%lu-", SID_REVISION );
snprintf(name, len, "S-%lu-", SID_REVISION );

// Identifier authority
if ((sia->Value[0] != 0) || (sia->Value[1] != 0))
{
sprintf(name + strlen(name), "0x%02hx%02hx%02hx%02hx%02hx%02hx",
snprintf(name + strlen(name), len - strlen(name),
"0x%02hx%02hx%02hx%02hx%02hx%02hx",
(USHORT)sia->Value[0],
(USHORT)sia->Value[1],
(USHORT)sia->Value[2],
Expand All @@ -114,7 +115,7 @@ static char *getTextualSid(SID* sid) {
}
else
{
sprintf(name + strlen(name), "%lu",
snprintf(name + strlen(name), len - strlen(name), "%lu",
(ULONG)(sia->Value[5] ) +
(ULONG)(sia->Value[4] << 8) +
(ULONG)(sia->Value[3] << 16) +
Expand All @@ -123,7 +124,7 @@ static char *getTextualSid(SID* sid) {

// finally, the sub-authorities
for (i=0 ; i<count; i++) {
sprintf(name + strlen(name), "-%lu",
snprintf(name + strlen(name), len - strlen(name), "-%lu",
*GetSidSubAuthority(sid, i) );
}

Expand Down

1 comment on commit 9c4bc2c

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