From: Peter Howkins Date: Thu, 26 Apr 2018 00:36:02 +0000 (+0100) Subject: dtappbuilder: Coverity fixes for mising return value and copy into fixed size buffer X-Git-Tag: 2.2.4a~61 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bb9eef427f85212440eacbd5cf57502c5b0256ac;p=oweals%2Fcde.git dtappbuilder: Coverity fixes for mising return value and copy into fixed size buffer --- diff --git a/cde/programs/dtappbuilder/src/ab/abobj_list.c b/cde/programs/dtappbuilder/src/ab/abobj_list.c index 2bd608ad..de5c038d 100644 --- a/cde/programs/dtappbuilder/src/ab/abobj_list.c +++ b/cde/programs/dtappbuilder/src/ab/abobj_list.c @@ -287,9 +287,7 @@ abobj_list_obj_reparented( if (obj_get_parent(obj) == NULL) { module = obj_get_name(obj_get_module(info->old_parent)); - strcpy(full_name, module); - strcat(full_name, " :: "); - strcat(full_name, obj_get_name(obj)); + snprintf(full_name, sizeof(full_name), "%s :: %s", module, obj_get_name(obj)); name = full_name; } else diff --git a/cde/programs/dtappbuilder/src/ab/dtbuilder.c.src b/cde/programs/dtappbuilder/src/ab/dtbuilder.c.src index 9dd5af81..de266975 100644 --- a/cde/programs/dtappbuilder/src/ab/dtbuilder.c.src +++ b/cde/programs/dtappbuilder/src/ab/dtbuilder.c.src @@ -321,7 +321,7 @@ init_ab(ABInitProcInfo init_info) user_file_name = init_info->argv[1]; } - strcpy(file_name, user_file_name); + snprintf(file_name, sizeof(file_name), "%s", user_file_name); if (!util_file_exists(file_name)) { *file_name = 0; diff --git a/cde/programs/dtappbuilder/src/ab/pal_menu.c b/cde/programs/dtappbuilder/src/ab/pal_menu.c index 8b3551d6..448b66fd 100644 --- a/cde/programs/dtappbuilder/src/ab/pal_menu.c +++ b/cde/programs/dtappbuilder/src/ab/pal_menu.c @@ -891,7 +891,7 @@ menu_editCB( /* store off original clipboard menu name and temporarily * set it to a dummy string. */ - strcpy(namebuf, obj_get_name(pms->clipboard_menu)); + snprintf(namebuf, sizeof(namebuf), "%s", obj_get_name(pms->clipboard_menu)); obj_set_name(pms->clipboard_menu, "MENU_DUMMY"); /* duplicate clipboard menu & menu-items */ diff --git a/cde/programs/dtappbuilder/src/ab/palette_stubs.c b/cde/programs/dtappbuilder/src/ab/palette_stubs.c index 004bc6e5..4107c492 100644 --- a/cde/programs/dtappbuilder/src/ab/palette_stubs.c +++ b/cde/programs/dtappbuilder/src/ab/palette_stubs.c @@ -202,8 +202,7 @@ build_export_menu( /* Use the name of the module as the string * for the dynamic menu. */ - strcpy(name, obj_get_name(module)); - strcat(name, "..."); + snprintf(name, sizeof(name), "%s...", obj_get_name(module)); label = XmStringCreateLocalized(name); mpb = XtVaCreateManagedWidget(name, xmPushButtonWidgetClass, diff --git a/cde/programs/dtappbuilder/src/ab/projP_utils.c b/cde/programs/dtappbuilder/src/ab/projP_utils.c index 015bd25b..e342e189 100644 --- a/cde/programs/dtappbuilder/src/ab/projP_utils.c +++ b/cde/programs/dtappbuilder/src/ab/projP_utils.c @@ -184,8 +184,7 @@ projP_show_save_as_bil_chooser( XtFree(title); textf = XmFileSelectionBoxGetChild(AB_generic_chooser, XmDIALOG_TEXT); - strcpy(init_name, (char *)obj_get_name(obj)); - strcat(init_name, ".bil"); + snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj)); XmTextFieldSetString(textf, init_name); XtManageChild(AB_generic_chooser); ui_win_front(AB_generic_chooser); diff --git a/cde/programs/dtappbuilder/src/ab/proj_utils.c b/cde/programs/dtappbuilder/src/ab/proj_utils.c index 26e07808..688bb4cf 100644 --- a/cde/programs/dtappbuilder/src/ab/proj_utils.c +++ b/cde/programs/dtappbuilder/src/ab/proj_utils.c @@ -458,8 +458,7 @@ proj_show_save_proj_as_chooser( XtFree(title); textf = XmFileSelectionBoxGetChild(AB_generic_chooser, XmDIALOG_TEXT); - strcpy(init_name, (char *)obj_get_name(proj_get_project())); - strcat(init_name, ".bip"); + snprintf(init_name, sizeof(init_name), "%s.bip", (char *)obj_get_name(proj_get_project())); XmTextFieldSetString(textf, init_name); XtManageChild(AB_generic_chooser); ui_win_front(AB_generic_chooser); @@ -644,12 +643,12 @@ save_proj_as_bip( /* Save the old project directory before chdir'ing * to the new one. */ - strcpy(old_proj_dir, ab_get_cur_dir()); + snprintf(old_proj_dir, sizeof(old_proj_dir), "%s", ab_get_cur_dir()); /* * Compose the project file name. */ - strcpy(new_filename, file); + snprintf(new_filename, sizeof(new_filename), "%s", file); abio_expand_bil_proj_path(new_filename); /* @@ -969,8 +968,7 @@ proj_show_export_bil_chooser( XtFree(title); textf = XmFileSelectionBoxGetChild(AB_generic_chooser, XmDIALOG_TEXT); - strcpy(init_name, (char *)obj_get_name(obj)); - strcat(init_name, ".bil"); + snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj)); XmTextFieldSetString(textf, init_name); XtManageChild(AB_generic_chooser); ui_win_front(AB_generic_chooser); @@ -1464,7 +1462,7 @@ proj_save_exploded( */ if ((obj_get_file(module) == NULL) || encap_file) { - strcpy(tmp_path, obj_get_name(module)); + snprintf(tmp_path, sizeof(tmp_path), "%s", obj_get_name(module)); abio_expand_file(tmp_path, mod_exp_file); if ( !util_file_exists(mod_exp_file) ) { @@ -2043,7 +2041,7 @@ save_as_encap( filename = XmTextFieldGetString(textf); if (util_strempty(filename)) - strcpy(init_name, (char *)obj_get_name(proj_get_project())); + snprintf(init_name, sizeof(init_name), "%s", (char *)obj_get_name(proj_get_project())); else util_check_name(filename, init_name); @@ -2089,7 +2087,7 @@ export_format_changed( ** exported. If a filename is specified, it might be either .bil or .uil. */ if (util_strempty(filename)) - strcpy(init_name, (char *)obj_get_name(module_obj)); + snprintf(init_name, sizeof(init_name), "%s", (char *)obj_get_name(module_obj)); else proj_get_file_basename(filename, init_name); @@ -2122,7 +2120,7 @@ save_proj_as_bix( ab_set_busy_cursor(TRUE); *bix_file = 0; - strcpy(bix_file, file); + snprintf(bix_file, sizeof(bix_file), "%s", file); if( abio_expand_bil_encapsulated_path(bix_file) != -1 ) { if( !util_file_exists(bix_file) ) diff --git a/cde/programs/dtappbuilder/src/ab/prop.c b/cde/programs/dtappbuilder/src/ab/prop.c index 9aec493c..346fcc40 100644 --- a/cde/programs/dtappbuilder/src/ab/prop.c +++ b/cde/programs/dtappbuilder/src/ab/prop.c @@ -788,7 +788,7 @@ prop_colorfield_init( /* Determine whether this is a foreground or background color field * and store the corresponding color-default in user-data. */ - strcpy(swatch_name, XtName(swatch)); + snprintf(swatch_name, sizeof(swatch_name), "%s", XtName(swatch)); if (strstr(swatch_name, "bg")) default_pix = WhitePixelOfScreen(XtScreen(swatch)); else @@ -805,7 +805,7 @@ prop_colorfield_init( XmNrecomputeSize, (XtArgVal)False, NULL); - strcpy(swatch_name, XtName(swatch)); + snprintf(swatch_name, sizeof(swatch_name), "%s", XtName(swatch)); /* Setup Prop Sheet changebar mechanism */ propP_changebar_init(changebar, menubutton); @@ -1987,7 +1987,7 @@ prop_graphic_filename_ok( } else { - strcpy(filebase, filename); + snprintf(filebase, sizeof(filebase), "%s", filename); /* Look to see if user typed in the full filename for the Graphic. * If so, strip off the extension and mark stripped to be True. */ diff --git a/cde/programs/dtappbuilder/src/ab/prop_items.c b/cde/programs/dtappbuilder/src/ab/prop_items.c index 14ac06ab..a238a8b0 100644 --- a/cde/programs/dtappbuilder/src/ab/prop_items.c +++ b/cde/programs/dtappbuilder/src/ab/prop_items.c @@ -874,7 +874,7 @@ prop_item_get_namebase( switch(iobj->label_type) { case AB_LABEL_SEPARATOR: - strcpy(namebuf, obj_get_name(iobj)); + snprintf(namebuf, sizeof(namebuf), "%s", obj_get_name(iobj)); starts = strstr(namebuf, SeparatorNamebase); namebase = strtok(starts, "_"); break; diff --git a/cde/programs/dtappbuilder/src/ab/ui_list.c b/cde/programs/dtappbuilder/src/ab/ui_list.c index c99f97be..c75a2b0d 100644 --- a/cde/programs/dtappbuilder/src/ab/ui_list.c +++ b/cde/programs/dtappbuilder/src/ab/ui_list.c @@ -279,6 +279,8 @@ ui_list_replace_item_prefix( new_xmitem_array[0] = NULL; } } + + return OK; } diff --git a/cde/programs/dtappbuilder/src/abmf/abmf.c b/cde/programs/dtappbuilder/src/abmf/abmf.c index b2930a61..b7f0a55c 100644 --- a/cde/programs/dtappbuilder/src/abmf/abmf.c +++ b/cde/programs/dtappbuilder/src/abmf/abmf.c @@ -800,8 +800,7 @@ parse_args(int argc, char *argv[], CmdlineArgs cmdline) else { char fileName[MAX_PATH_SIZE]; - strcpy(fileName, arg); - strcat(fileName, ".bil"); + snprintf(fileName, sizeof(fileName), "%s.bil", arg); newFile = istr_create(fileName); } @@ -1088,11 +1087,11 @@ load_module(ABObj module) if (obj_get_file(module) != NULL) { - strcpy(fileName, obj_get_file(module)); + snprintf(fileName, sizeof(fileName), "%s", obj_get_file(module)); } else { - strcpy(fileName, obj_get_name(module)); + snprintf(fileName, sizeof(fileName), "%s", obj_get_name(module)); if (!util_file_name_has_ab_extension(fileName)) { strcat(fileName, ".bil"); diff --git a/cde/programs/dtappbuilder/src/abmf/make_file.c b/cde/programs/dtappbuilder/src/abmf/make_file.c index d57f4b75..a799fd67 100644 --- a/cde/programs/dtappbuilder/src/abmf/make_file.c +++ b/cde/programs/dtappbuilder/src/abmf/make_file.c @@ -1351,7 +1351,7 @@ static STRING cvt_to_obj(STRING fileName) { static char buf[MAXPATHLEN] = ""; - strcpy(buf, fileName); + snprintf(buf, sizeof(buf), "%s", fileName); buf[strlen(buf)-1] = 'o'; return buf; } diff --git a/cde/programs/dtappbuilder/src/abmf/msg_cvt.c b/cde/programs/dtappbuilder/src/abmf/msg_cvt.c index 82953e64..d8b3b40a 100644 --- a/cde/programs/dtappbuilder/src/abmf/msg_cvt.c +++ b/cde/programs/dtappbuilder/src/abmf/msg_cvt.c @@ -145,8 +145,7 @@ get_cached_msg_set( char *project_name = obj_get_name(obj); char proj_suffixed_name[BUFSIZ]; - strcpy(proj_suffixed_name, project_name); - strcat(proj_suffixed_name, "_project"); + snprintf(proj_suffixed_name, sizeof(proj_suffixed_name), "%s_project", project_name); msg_set = MsgFile_sure_find_msg_set(msg_file, proj_suffixed_name); prev_msg_set = msg_set; diff --git a/cde/programs/dtappbuilder/src/abmf/msg_file.c b/cde/programs/dtappbuilder/src/abmf/msg_file.c index 9d9a897a..8db87816 100644 --- a/cde/programs/dtappbuilder/src/abmf/msg_file.c +++ b/cde/programs/dtappbuilder/src/abmf/msg_file.c @@ -388,8 +388,7 @@ MsgFile_create( ret_val = (MsgFile)NULL; } - strcpy(proj_name_suffixed, project_name); - strcat(proj_name_suffixed, "_project"); + snprintf(proj_name_suffixed, sizeof(proj_name_suffixed), "%s_project", project_name); if (MsgFile_sure_find_msg_set(new_msg_file, strdup(proj_name_suffixed)) == (MsgSet)NULL) diff --git a/cde/programs/dtappbuilder/src/abmf/obj_names.c b/cde/programs/dtappbuilder/src/abmf/obj_names.c index 863abfda..931f1445 100644 --- a/cde/programs/dtappbuilder/src/abmf/obj_names.c +++ b/cde/programs/dtappbuilder/src/abmf/obj_names.c @@ -206,7 +206,7 @@ abmfP_get_c_field_name(ABObj obj) goto epilogue; } - strcpy(fieldNameBuf, obj_get_name(obj)); + snprintf(fieldNameBuf, sizeof(fieldNameBuf), "%s", obj_get_name(obj)); abmfP_uncapitalize_first_char(fieldNameBuf); if (substructObj != NULL) @@ -520,8 +520,7 @@ abmfP_get_c_struct_type_name(ABObj obj) { return NULL; } - strcpy(name, abmfP_get_c_struct_ptr_type_name(obj)); - strcat(name, "Rec"); + snprintf(name, sizeof(name), "%sRec", abmfP_get_c_struct_ptr_type_name(obj)); return_c_ident(name); } @@ -538,9 +537,7 @@ abmfP_get_c_struct_ptr_type_name(ABObj obj) { return NULL; } - strcpy(name, typePrefixString); - strcat(name, abmfP_capitalize_first_char(varName)); - strcat(name, "Info"); + snprintf(name, sizeof(name), "%s%sInfo", typePrefixString, abmfP_capitalize_first_char(varName)); cvt_ident_to_type(name); return_c_ident(name); @@ -674,8 +671,7 @@ STRING abmfP_get_c_substruct_field_name(ABObj obj) { static char fieldName[MAX_NAME_SIZE]; - strcpy(fieldName, abmfP_uncapitalize_first_char(obj_get_name(obj))); - strcat(fieldName, "_items"); + snprintf(fieldName, sizeof(fieldName), "%s_items", abmfP_uncapitalize_first_char(obj_get_name(obj))); return_c_ident(fieldName); } @@ -690,8 +686,7 @@ abmfP_get_c_substruct_type_name(ABObj obj) { return NULL; } - strcpy(typeName, ptrTypeName); - strcat(typeName, "Rec"); + snprintf(typeName, sizeof(typeName), "%sRec", ptrTypeName); return_c_ident(typeName); } @@ -729,7 +724,7 @@ abmfP_get_c_substruct_ptr_type_name(ABObj obj) { strcpy(ptrTypeName, typePrefixString); strcat(ptrTypeName, - abmfP_capitalize_first_char(obj_get_name(module))); + abmfP_capitalize_first_char(obj_get_name(module))); strcat(ptrTypeName, abmfP_capitalize_first_char(varName)); strcat(ptrTypeName, "Items"); cvt_ident_to_type(ptrTypeName); @@ -751,9 +746,7 @@ abmfP_get_clear_proc_name(ABObj obj) { return NULL; } - strcpy(name, ptrTypeName); - strcat(name, "_"); - strcat(name, "clear"); + snprintf(name, sizeof(name), "%s_clear", ptrTypeName); return_c_ident(abmfP_uncapitalize_first_char(name)); } @@ -823,7 +816,7 @@ abmfP_get_widget_name(ABObj obj) name =abmfP_get_widget_name(objectObj); if ((name != NULL) && (name != nameBuf)) { - strcpy(nameBuf, name); + snprintf(nameBuf, sizeof(nameBuf), "%s", name); } if ((*nameBuf) != 0) { @@ -861,6 +854,7 @@ STRING abmfP_get_widget_name_for_res_file(ABObj obj) { static char name[MAX_NAME_SIZE]; + char nameTemp[sizeof(MAX_NAME_SIZE)]; *name = 0; assert(abmfP_parent(obj) != NULL); @@ -912,11 +906,12 @@ abmfP_get_widget_name_for_res_file(ABObj obj) /* we can't use abmfP_get_widget_name twice in the same printf, * because of the static string buffer. */ - strcpy(name, abmfP_get_app_class_name(obj)); - strcat(name, "*"); - strcat(name, abmfP_get_widget_name(container)); - strcat(name, "*"); - strcat(name, abmfP_get_widget_name(obj)); + snprintf(nameTemp, sizeof(nameTemp), "%s*%s*", + abmfP_get_app_class_name(obj), + abmfP_get_widget_name(container)); + snprintf(name, sizeof(name), "%s%s", + nameTemp, + abmfP_get_widget_name(obj)); } return name; } @@ -1042,6 +1037,7 @@ static STRING abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize) { char tmpBuf[1024] = ""; + char tmpBuf2[1024] = ""; ABObj module= obj_get_module(obj); if (module == NULL) @@ -1050,10 +1046,12 @@ abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize) } else { - strcpy(tmpBuf, identPrefixString); - strcat(tmpBuf, obj_get_name(module)); - strcat(tmpBuf, "_"); - strcat(tmpBuf, obj_get_name(obj)); + /* Warning: Due to obj_get_name() returning a pointer to + * static data this cannot be one snprintf() */ + snprintf(tmpBuf2, sizeof(tmpBuf2), "%s%s_", + identPrefixString, obj_get_name(module)); + snprintf(tmpBuf, sizeof(tmpBuf), "%s%s", + tmpBuf2, obj_get_name(obj)); cvt_type_to_ident(tmpBuf, prefixBuf, prefixBufSize); } @@ -1070,8 +1068,7 @@ abmfP_get_c_app_root_win_name(ABObj obj) ABObj root_window= abmfP_get_root_window(project); *root_widget_name = 0; - strcpy(root_widget_name, abmfP_lib_get_toplevel_widget->name); - strcat(root_widget_name, "()"); + snprintf(root_widget_name, sizeof(root_widget_name), "%s()", abmfP_lib_get_toplevel_widget->name); return root_widget_name; } @@ -1285,8 +1282,7 @@ abmfP_get_msg_clear_proc_name(ABObj msgObj) { static char name[MAX_NAME_SIZE]; - strcpy(name, abmfP_get_c_struct_global_name(msgObj)); - strcat(name, "_initialize"); + snprintf(name, sizeof(name), "%s_initialize", abmfP_get_c_struct_global_name(msgObj)); return_c_ident(name); } diff --git a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c index 7b461970..700862fe 100644 --- a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c +++ b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c @@ -471,7 +471,7 @@ write_map_window( } else { - strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent)); + snprintf(winParentName, sizeof(winParentName), "%s", abmfP_get_c_name(genCodeInfo, winParent)); } abio_printf(codeFile, "%s(%s, %s);\n", abmfP_get_init_proc_name(window), diff --git a/cde/programs/dtappbuilder/src/abmf/stubs_c_file.c b/cde/programs/dtappbuilder/src/abmf/stubs_c_file.c index ef66418f..afe200db 100644 --- a/cde/programs/dtappbuilder/src/abmf/stubs_c_file.c +++ b/cde/programs/dtappbuilder/src/abmf/stubs_c_file.c @@ -401,7 +401,7 @@ set_up_user_type_variables(GenCodeInfo genCodeInfo, ABObj toObj) } else { - strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent)); + snprintf(winParentName, sizeof(winParentName), "%s", abmfP_get_c_name(genCodeInfo, winParent)); } /* diff --git a/cde/programs/dtappbuilder/src/abmf/ui_c_file.c b/cde/programs/dtappbuilder/src/abmf/ui_c_file.c index 24bd947c..950d64fe 100644 --- a/cde/programs/dtappbuilder/src/abmf/ui_c_file.c +++ b/cde/programs/dtappbuilder/src/abmf/ui_c_file.c @@ -134,7 +134,7 @@ strip_spaces_and_dots(char *mname) static char new_name[MAXPATHLEN]; char *p; - strcpy(new_name, mname); + snprintf(new_name, sizeof(new_name), "%s", mname); p = (char *) strrchr(new_name, '.'); if (p) p = (char *) strrchr(p, '.'); @@ -1046,7 +1046,7 @@ write_call_user_post_create_procs(GenCodeInfo genCodeInfo, ABObj subObj) if (targetObj == NULL) { - strcpy(targetStructPtrName, abmfP_str_null); + snprintf(targetStructPtrName, sizeof(targetStructPtrName), "%s", abmfP_str_null); } else { diff --git a/cde/programs/dtappbuilder/src/abmf/utils.c b/cde/programs/dtappbuilder/src/abmf/utils.c index ed2731c6..d38361a7 100644 --- a/cde/programs/dtappbuilder/src/abmf/utils.c +++ b/cde/programs/dtappbuilder/src/abmf/utils.c @@ -108,7 +108,7 @@ abmfP_capitalize_first_char(STRING str) if (str != name) /* if we get called w/our own buffer, don't copy */ { - strcpy(name, str); + snprintf(name, sizeof(name), "%s", str); } name[0] = toupper(str[0]); @@ -132,7 +132,7 @@ abmfP_uncapitalize_first_char(STRING str) if (str != name) /* if we get called w/our own buffer, don't copy */ { - strcpy(name, str); + snprintf(name, sizeof(name), "%s", str); } name[0] = tolower(str[0]); @@ -1295,6 +1295,8 @@ abmfP_obj_get_centering_type(ABObj obj) if ((left_attach_type == AB_ATTACH_CENTER_GRIDLINE) && (top_attach_type == AB_ATTACH_CENTER_GRIDLINE)) return("DTB_CENTER_POSITION_BOTH"); + + return("DTB_CENTER_NONE"); } BOOL @@ -1335,6 +1337,8 @@ abmfP_obj_get_group_type(ABObj obj) case AB_GROUP_ROWSCOLUMNS: return("DTB_GROUP_ROWSCOLUMNS"); } + + return("DTB_GROUP_NONE"); } STRING diff --git a/cde/programs/dtappbuilder/src/abmf/write_c.c b/cde/programs/dtappbuilder/src/abmf/write_c.c index 0accd811..28bd572e 100644 --- a/cde/programs/dtappbuilder/src/abmf/write_c.c +++ b/cde/programs/dtappbuilder/src/abmf/write_c.c @@ -809,7 +809,7 @@ abmfP_write_create_proc_begin( } - +int abmfP_write_clear_proc_begin( GenCodeInfo genCodeInfo, ABObj obj @@ -827,6 +827,7 @@ abmfP_write_clear_proc_begin( } +int abmfP_write_init_proc_decl( GenCodeInfo genCodeInfo, ABObj obj @@ -857,9 +858,10 @@ abmfP_write_init_proc_decl( NULL /* Argument name */ ); } + return 0; } - +int abmfP_write_init_proc_begin( GenCodeInfo genCodeInfo, ABObj obj diff --git a/cde/programs/dtappbuilder/src/libABil/abuil_load.c b/cde/programs/dtappbuilder/src/libABil/abuil_load.c index c14616f6..0d6ebd1c 100644 --- a/cde/programs/dtappbuilder/src/libABil/abuil_load.c +++ b/cde/programs/dtappbuilder/src/libABil/abuil_load.c @@ -598,7 +598,7 @@ widget_into_module( obj_set_name(ab_widget, ab_name); - strcpy(class_name, ab_map_entry->widget_name); + snprintf(class_name, sizeof(class_name), "%s", ab_map_entry->widget_name); class_name[0] = tolower(class_name[0]); strcat(class_name, CLASS_SUFFIX); obj_set_class_name(ab_widget, class_name); diff --git a/cde/programs/dtappbuilder/src/libABil/abuil_print.c b/cde/programs/dtappbuilder/src/libABil/abuil_print.c index db19e1ab..7c3c627a 100644 --- a/cde/programs/dtappbuilder/src/libABil/abuil_print.c +++ b/cde/programs/dtappbuilder/src/libABil/abuil_print.c @@ -227,8 +227,7 @@ suffixed( if (widget_instance_name == NULL) return(util_strsafe(widget_instance_name)); - strcpy(buf, widget_instance_name); - strcat(buf, INSTANCE_SUFFIX); + snprintf(buf, sizeof(buf), "%s%s", widget_instance_name, INSTANCE_SUFFIX); return(buf); } diff --git a/cde/programs/dtappbuilder/src/libABil/bil_loadatt.c b/cde/programs/dtappbuilder/src/libABil/bil_loadatt.c index a9a7e545..f70d24bf 100644 --- a/cde/programs/dtappbuilder/src/libABil/bil_loadatt.c +++ b/cde/programs/dtappbuilder/src/libABil/bil_loadatt.c @@ -1067,7 +1067,7 @@ bilP_load_att_label(BIL_TOKEN valueToken) char filename[512]; STRING ext; - strcpy(filename, istr_string(value)); + snprintf(filename, sizeof(filename), "%s", istr_string(value)); if (util_file_name_has_extension(filename, "pm") || util_file_name_has_extension(filename, "xpm") || util_file_name_has_extension(filename, "bm") || diff --git a/cde/programs/dtappbuilder/src/libABil/bil_store.c b/cde/programs/dtappbuilder/src/libABil/bil_store.c index 6dff9026..1e0c0b38 100644 --- a/cde/programs/dtappbuilder/src/libABil/bil_store.c +++ b/cde/programs/dtappbuilder/src/libABil/bil_store.c @@ -1702,7 +1702,7 @@ store_attribute( * Assume: indent char is tab */ assert(abio_get_indent_char(outFile) == '\t'); - strcpy(attrbuf, bilP_token_to_string(attr)); + snprintf(attrbuf, sizeof(attrbuf), "%s", bilP_token_to_string(attr)); attrLen = strlen(attrbuf); attrWidth = (abio_get_indent(outFile) * 8) + attrLen; firstWidthIter = TRUE; /* go through at least once */ diff --git a/cde/programs/dtappbuilder/src/libABil/gil_loadatt.c b/cde/programs/dtappbuilder/src/libABil/gil_loadatt.c index 8aa1dc2f..7d3902c2 100644 --- a/cde/programs/dtappbuilder/src/libABil/gil_loadatt.c +++ b/cde/programs/dtappbuilder/src/libABil/gil_loadatt.c @@ -2291,6 +2291,8 @@ load_att_stored_length(FILE * inFile, ABObj obj, ABObj root_obj) { obj_set_max_length(obj, tmp_int); } + + return 0; } /* diff --git a/cde/programs/dtappbuilder/src/libABil/load.c b/cde/programs/dtappbuilder/src/libABil/load.c index ac635697..8665299e 100644 --- a/cde/programs/dtappbuilder/src/libABil/load.c +++ b/cde/programs/dtappbuilder/src/libABil/load.c @@ -218,11 +218,9 @@ int abil_print_load_err(int errmsg) { static BOOL errmsg_tbl_init = FALSE; - char msg[1024]; + char msg[1024] = ""; int msgLen = 0; - *msg = 0; - *msg = 0; /* ** Load up the error message table if this is the first time we've ** needed to output an error message. @@ -240,11 +238,11 @@ abil_print_load_err(int errmsg) if (!abil_loadmsg_err_printed()) { if(Errormsg[errmsg].msg_id < 0) { - strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33, + snprintf(msg, sizeof(msg), "%s", catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33, "syntax error")); } else { - strcat(msg, + snprintf(msg, sizeof(msg), "%s", catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, Errormsg[errmsg].msg_id, Errormsg[errmsg].def_str)); diff --git a/cde/programs/dtappbuilder/src/libABobj/obj_fields.c b/cde/programs/dtappbuilder/src/libABobj/obj_fields.c index 65c4032a..e0dd61cc 100644 --- a/cde/programs/dtappbuilder/src/libABobj/obj_fields.c +++ b/cde/programs/dtappbuilder/src/libABobj/obj_fields.c @@ -3939,6 +3939,8 @@ obj_get_pane_min( ABObj obj) return (obj->info.container.pane_min); if (obj_is_layers(obj)) return (obj->info.layer.pane_min); + + return -1; } int @@ -3978,6 +3980,8 @@ obj_get_pane_max( ABObj obj) return (obj->info.container.pane_max); if (obj_is_layers(obj)) return (obj->info.layer.pane_max); + + return -1; } int diff --git a/cde/programs/dtappbuilder/src/libABobj/obj_utils.c b/cde/programs/dtappbuilder/src/libABobj/obj_utils.c index bb34c5cb..18150482 100644 --- a/cde/programs/dtappbuilder/src/libABobj/obj_utils.c +++ b/cde/programs/dtappbuilder/src/libABobj/obj_utils.c @@ -715,9 +715,9 @@ ab_ident_from_file_name(STRING filename) if (filename != NULL) { if (p = (char *) strrchr(filename, '/')) - strcpy(buf, p + 1); + snprintf(buf, sizeof(buf), "%s", p + 1); else - strcpy(buf, filename); + snprintf(buf, sizeof(buf), "%s", filename); if (p = (char *) strrchr(buf, '.')) *p = '\0'; diff --git a/cde/programs/dtappbuilder/src/libABobjXm/objxm_util.c b/cde/programs/dtappbuilder/src/libABobjXm/objxm_util.c index 263cdeb1..87ad4358 100644 --- a/cde/programs/dtappbuilder/src/libABobjXm/objxm_util.c +++ b/cde/programs/dtappbuilder/src/libABobjXm/objxm_util.c @@ -431,7 +431,8 @@ objxm_xmstr_to_str( while(XmStringGetNextSegment(context, &seg, &char_set_tag, &dir, &sep)) { - p += (strlen(strcpy(p, seg))); + snprintf(p, sizeof(buf), "%s", seg); + p += (strlen(p)); if (sep == TRUE) { *p++ = '\n'; diff --git a/cde/programs/dtappbuilder/src/libAButil/abio_path.c b/cde/programs/dtappbuilder/src/libAButil/abio_path.c index d03746ff..134207cb 100644 --- a/cde/programs/dtappbuilder/src/libAButil/abio_path.c +++ b/cde/programs/dtappbuilder/src/libAButil/abio_path.c @@ -90,7 +90,7 @@ abio_expand_file( /* * Expand the file name and store to it. */ - strcpy(Buf, file); + snprintf(Buf, sizeof(Buf), "%s", file); if (abio_expand_bil_module_path(Buf) == -1) return -1;