< prev index next >

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

Print this page
rev 16167 : 8170525: Fix minor issues in awt coding

@@ -1233,16 +1233,18 @@
    currentX11InputMethodInstance = (jobject)client_data;
 
     if (status_draw->type == XIMTextType){
         XIMText *text = (status_draw->data).text;
         if (text != NULL){
-          if (text->string.multi_byte != NULL){
-              strcpy(statusWindow->status, text->string.multi_byte);
+          if (text->string.multi_byte != NULL) {
+              strncpy(statusWindow->status, text->string.multi_byte, MAX_STATUS_LEN);
+              statusWindow->status[MAX_STATUS_LEN-1] = '\0';
           }
-          else{
+          else {
               char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
-              strcpy(statusWindow->status, mbstr);
+              strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
+              statusWindow->status[MAX_STATUS_LEN-1] = '\0';
           }
           statusWindow->on = True;
           onoffStatusWindow(pX11IMData, statusWindow->parent, True);
           paintStatusWindow(statusWindow);
         }
< prev index next >