Skip to content

Commit dd33a8e

Browse files
committed
8262461: handle wcstombsdmp return value correctly in unix awt_InputMethod.c
Reviewed-by: psadhukhan, azvegint, aivanov
1 parent 3b350ad commit dd33a8e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, 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
@@ -1235,8 +1235,12 @@ StatusDrawCallback(XIC ic, XPointer client_data,
12351235
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
12361236
} else {
12371237
char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
1238+
if (mbstr == NULL) {
1239+
goto finally;
1240+
}
12381241
strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
12391242
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
1243+
free(mbstr);
12401244
}
12411245
statusWindow->on = True;
12421246
onoffStatusWindow(pX11IMData, statusWindow->parent, True);

0 commit comments

Comments
 (0)