Skip to content

Commit

Permalink
Merge pull request #678 from knn-k/macosSprintf
Browse files Browse the repository at this point in the history
macOS: Stop using sprintf in java.desktop
  • Loading branch information
pshipton committed Jul 5, 2023
2 parents 5a8a560 + e2cc394 commit 0403650
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (C) Copyright IBM Corp. 2023 All Rights Reserved.
* ===========================================================================
*/

#import "java_awt_geom_PathIterator.h"
#import "sun_font_CStrike.h"
Expand Down Expand Up @@ -102,7 +107,7 @@ + (AWTStrike *) awtStrikeForFont:(AWTFont *)awtFont
#define AWT_FONT_CLEANUP_FINISH \
if (_fontThrowJavaException == YES) { \
char s[512]; \
sprintf(s, "%s-%s:%d", __FILE__, __FUNCTION__, __LINE__); \
snprintf(s, sizeof(s), "%s-%s:%d", __FILE__, __FUNCTION__, __LINE__); \
JNU_ThrowByName(env, "java/lang/RuntimeException", s); \
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (C) Copyright IBM Corp. 2023 All Rights Reserved.
* ===========================================================================
*/

//#define USE_ERROR
//#define USE_TRACE
Expand Down Expand Up @@ -635,7 +640,7 @@ void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator) {
if (channelName == NULL) {
return;
}
sprintf(channelName, "Ch %d", ch);
snprintf(channelName, 16, "Ch %d", ch);
}

void* jControls[2];
Expand Down

0 comments on commit 0403650

Please sign in to comment.