Skip to content

Commit 72e1e15

Browse files
author
Damon Nguyen
committed
8373474: 2 Unintentional format string defect groups in jabswitch.cpp
Reviewed-by: aivanov, prr, azvegint
1 parent f5249db commit 72e1e15

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, 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
@@ -226,9 +226,9 @@ int modify(bool enable) {
226226
printf("Couldn't create file: %s\n", path);
227227
perror("Error");
228228
} else {
229-
char str[100] = "assistive_technologies=com.sun.java.accessibility.AccessBridge\n";
230-
strcat_s(str, "screen_magnifier_present=true\n");
231-
fprintf(origFile, str);
229+
fprintf(origFile, "%s",
230+
"assistive_technologies=com.sun.java.accessibility.AccessBridge\n"
231+
"screen_magnifier_present=true\n");
232232
fclose(origFile);
233233
}
234234
} else {
@@ -314,11 +314,11 @@ void printVersion() {
314314
pVSInfo->dwProductVersionMS & 0xFFFF,
315315
pVSInfo->dwProductVersionLS >> 16,
316316
pVSInfo->dwProductVersionLS & 0xFFFF );
317-
char outputString[100];
318-
strcpy_s(outputString, "jabswitch ");
319-
strcat_s(outputString, versionString);
320-
strcat_s(outputString, "\njabswitch enables or disables the Java Access Bridge.\n");
321-
printf(outputString);
317+
printf(
318+
"jabswitch %s\n"
319+
"jabswitch enables or disables the Java Access Bridge.\n",
320+
versionString
321+
);
322322
}
323323

324324
int regEnable() {

0 commit comments

Comments
 (0)