1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtappbuilder: Coverity fixes for mising return value and copy into fixed size buffer

This commit is contained in:
Peter Howkins 2018-04-26 01:36:02 +01:00
parent 4007d3a460
commit bb9eef427f
29 changed files with 81 additions and 82 deletions

View file

@ -287,9 +287,7 @@ abobj_list_obj_reparented(
if (obj_get_parent(obj) == NULL) if (obj_get_parent(obj) == NULL)
{ {
module = obj_get_name(obj_get_module(info->old_parent)); module = obj_get_name(obj_get_module(info->old_parent));
strcpy(full_name, module); snprintf(full_name, sizeof(full_name), "%s :: %s", module, obj_get_name(obj));
strcat(full_name, " :: ");
strcat(full_name, obj_get_name(obj));
name = full_name; name = full_name;
} }
else else

View file

@ -321,7 +321,7 @@ init_ab(ABInitProcInfo init_info)
user_file_name = init_info->argv[1]; 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)) if (!util_file_exists(file_name))
{ {
*file_name = 0; *file_name = 0;

View file

@ -891,7 +891,7 @@ menu_editCB(
/* store off original clipboard menu name and temporarily /* store off original clipboard menu name and temporarily
* set it to a dummy string. * 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"); obj_set_name(pms->clipboard_menu, "MENU_DUMMY");
/* duplicate clipboard menu & menu-items */ /* duplicate clipboard menu & menu-items */

View file

@ -202,8 +202,7 @@ build_export_menu(
/* Use the name of the module as the string /* Use the name of the module as the string
* for the dynamic menu. * for the dynamic menu.
*/ */
strcpy(name, obj_get_name(module)); snprintf(name, sizeof(name), "%s...", obj_get_name(module));
strcat(name, "...");
label = XmStringCreateLocalized(name); label = XmStringCreateLocalized(name);
mpb = XtVaCreateManagedWidget(name, mpb = XtVaCreateManagedWidget(name,
xmPushButtonWidgetClass, xmPushButtonWidgetClass,

View file

@ -184,8 +184,7 @@ projP_show_save_as_bil_chooser(
XtFree(title); XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser, textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT); XmDIALOG_TEXT);
strcpy(init_name, (char *)obj_get_name(obj)); snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj));
strcat(init_name, ".bil");
XmTextFieldSetString(textf, init_name); XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser); XtManageChild(AB_generic_chooser);
ui_win_front(AB_generic_chooser); ui_win_front(AB_generic_chooser);

View file

@ -458,8 +458,7 @@ proj_show_save_proj_as_chooser(
XtFree(title); XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser, textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT); XmDIALOG_TEXT);
strcpy(init_name, (char *)obj_get_name(proj_get_project())); snprintf(init_name, sizeof(init_name), "%s.bip", (char *)obj_get_name(proj_get_project()));
strcat(init_name, ".bip");
XmTextFieldSetString(textf, init_name); XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser); XtManageChild(AB_generic_chooser);
ui_win_front(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 /* Save the old project directory before chdir'ing
* to the new one. * 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. * Compose the project file name.
*/ */
strcpy(new_filename, file); snprintf(new_filename, sizeof(new_filename), "%s", file);
abio_expand_bil_proj_path(new_filename); abio_expand_bil_proj_path(new_filename);
/* /*
@ -969,8 +968,7 @@ proj_show_export_bil_chooser(
XtFree(title); XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser, textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT); XmDIALOG_TEXT);
strcpy(init_name, (char *)obj_get_name(obj)); snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj));
strcat(init_name, ".bil");
XmTextFieldSetString(textf, init_name); XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser); XtManageChild(AB_generic_chooser);
ui_win_front(AB_generic_chooser); ui_win_front(AB_generic_chooser);
@ -1464,7 +1462,7 @@ proj_save_exploded(
*/ */
if ((obj_get_file(module) == NULL) || encap_file) 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); abio_expand_file(tmp_path, mod_exp_file);
if ( !util_file_exists(mod_exp_file) ) if ( !util_file_exists(mod_exp_file) )
{ {
@ -2043,7 +2041,7 @@ save_as_encap(
filename = XmTextFieldGetString(textf); filename = XmTextFieldGetString(textf);
if (util_strempty(filename)) 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 else
util_check_name(filename, init_name); 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. ** exported. If a filename is specified, it might be either .bil or .uil.
*/ */
if (util_strempty(filename)) 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 else
proj_get_file_basename(filename, init_name); proj_get_file_basename(filename, init_name);
@ -2122,7 +2120,7 @@ save_proj_as_bix(
ab_set_busy_cursor(TRUE); ab_set_busy_cursor(TRUE);
*bix_file = 0; *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( abio_expand_bil_encapsulated_path(bix_file) != -1 )
{ {
if( !util_file_exists(bix_file) ) if( !util_file_exists(bix_file) )

View file

@ -788,7 +788,7 @@ prop_colorfield_init(
/* Determine whether this is a foreground or background color field /* Determine whether this is a foreground or background color field
* and store the corresponding color-default in user-data. * 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")) if (strstr(swatch_name, "bg"))
default_pix = WhitePixelOfScreen(XtScreen(swatch)); default_pix = WhitePixelOfScreen(XtScreen(swatch));
else else
@ -805,7 +805,7 @@ prop_colorfield_init(
XmNrecomputeSize, (XtArgVal)False, XmNrecomputeSize, (XtArgVal)False,
NULL); NULL);
strcpy(swatch_name, XtName(swatch)); snprintf(swatch_name, sizeof(swatch_name), "%s", XtName(swatch));
/* Setup Prop Sheet changebar mechanism */ /* Setup Prop Sheet changebar mechanism */
propP_changebar_init(changebar, menubutton); propP_changebar_init(changebar, menubutton);
@ -1987,7 +1987,7 @@ prop_graphic_filename_ok(
} }
else else
{ {
strcpy(filebase, filename); snprintf(filebase, sizeof(filebase), "%s", filename);
/* Look to see if user typed in the full filename for the Graphic. /* 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. * If so, strip off the extension and mark stripped to be True.
*/ */

View file

@ -874,7 +874,7 @@ prop_item_get_namebase(
switch(iobj->label_type) switch(iobj->label_type)
{ {
case AB_LABEL_SEPARATOR: case AB_LABEL_SEPARATOR:
strcpy(namebuf, obj_get_name(iobj)); snprintf(namebuf, sizeof(namebuf), "%s", obj_get_name(iobj));
starts = strstr(namebuf, SeparatorNamebase); starts = strstr(namebuf, SeparatorNamebase);
namebase = strtok(starts, "_"); namebase = strtok(starts, "_");
break; break;

View file

@ -279,6 +279,8 @@ ui_list_replace_item_prefix(
new_xmitem_array[0] = NULL; new_xmitem_array[0] = NULL;
} }
} }
return OK;
} }

View file

@ -800,8 +800,7 @@ parse_args(int argc, char *argv[], CmdlineArgs cmdline)
else else
{ {
char fileName[MAX_PATH_SIZE]; char fileName[MAX_PATH_SIZE];
strcpy(fileName, arg); snprintf(fileName, sizeof(fileName), "%s.bil", arg);
strcat(fileName, ".bil");
newFile = istr_create(fileName); newFile = istr_create(fileName);
} }
@ -1088,11 +1087,11 @@ load_module(ABObj module)
if (obj_get_file(module) != NULL) if (obj_get_file(module) != NULL)
{ {
strcpy(fileName, obj_get_file(module)); snprintf(fileName, sizeof(fileName), "%s", obj_get_file(module));
} }
else else
{ {
strcpy(fileName, obj_get_name(module)); snprintf(fileName, sizeof(fileName), "%s", obj_get_name(module));
if (!util_file_name_has_ab_extension(fileName)) if (!util_file_name_has_ab_extension(fileName))
{ {
strcat(fileName, ".bil"); strcat(fileName, ".bil");

View file

@ -1351,7 +1351,7 @@ static STRING
cvt_to_obj(STRING fileName) cvt_to_obj(STRING fileName)
{ {
static char buf[MAXPATHLEN] = ""; static char buf[MAXPATHLEN] = "";
strcpy(buf, fileName); snprintf(buf, sizeof(buf), "%s", fileName);
buf[strlen(buf)-1] = 'o'; buf[strlen(buf)-1] = 'o';
return buf; return buf;
} }

View file

@ -145,8 +145,7 @@ get_cached_msg_set(
char *project_name = obj_get_name(obj); char *project_name = obj_get_name(obj);
char proj_suffixed_name[BUFSIZ]; char proj_suffixed_name[BUFSIZ];
strcpy(proj_suffixed_name, project_name); snprintf(proj_suffixed_name, sizeof(proj_suffixed_name), "%s_project", project_name);
strcat(proj_suffixed_name, "_project");
msg_set = MsgFile_sure_find_msg_set(msg_file, proj_suffixed_name); msg_set = MsgFile_sure_find_msg_set(msg_file, proj_suffixed_name);
prev_msg_set = msg_set; prev_msg_set = msg_set;

View file

@ -388,8 +388,7 @@ MsgFile_create(
ret_val = (MsgFile)NULL; ret_val = (MsgFile)NULL;
} }
strcpy(proj_name_suffixed, project_name); snprintf(proj_name_suffixed, sizeof(proj_name_suffixed), "%s_project", project_name);
strcat(proj_name_suffixed, "_project");
if (MsgFile_sure_find_msg_set(new_msg_file, strdup(proj_name_suffixed)) if (MsgFile_sure_find_msg_set(new_msg_file, strdup(proj_name_suffixed))
== (MsgSet)NULL) == (MsgSet)NULL)

View file

@ -206,7 +206,7 @@ abmfP_get_c_field_name(ABObj obj)
goto epilogue; goto epilogue;
} }
strcpy(fieldNameBuf, obj_get_name(obj)); snprintf(fieldNameBuf, sizeof(fieldNameBuf), "%s", obj_get_name(obj));
abmfP_uncapitalize_first_char(fieldNameBuf); abmfP_uncapitalize_first_char(fieldNameBuf);
if (substructObj != NULL) if (substructObj != NULL)
@ -520,8 +520,7 @@ abmfP_get_c_struct_type_name(ABObj obj)
{ {
return NULL; return NULL;
} }
strcpy(name, abmfP_get_c_struct_ptr_type_name(obj)); snprintf(name, sizeof(name), "%sRec", abmfP_get_c_struct_ptr_type_name(obj));
strcat(name, "Rec");
return_c_ident(name); return_c_ident(name);
} }
@ -538,9 +537,7 @@ abmfP_get_c_struct_ptr_type_name(ABObj obj)
{ {
return NULL; return NULL;
} }
strcpy(name, typePrefixString); snprintf(name, sizeof(name), "%s%sInfo", typePrefixString, abmfP_capitalize_first_char(varName));
strcat(name, abmfP_capitalize_first_char(varName));
strcat(name, "Info");
cvt_ident_to_type(name); cvt_ident_to_type(name);
return_c_ident(name); return_c_ident(name);
@ -674,8 +671,7 @@ STRING
abmfP_get_c_substruct_field_name(ABObj obj) abmfP_get_c_substruct_field_name(ABObj obj)
{ {
static char fieldName[MAX_NAME_SIZE]; static char fieldName[MAX_NAME_SIZE];
strcpy(fieldName, abmfP_uncapitalize_first_char(obj_get_name(obj))); snprintf(fieldName, sizeof(fieldName), "%s_items", abmfP_uncapitalize_first_char(obj_get_name(obj)));
strcat(fieldName, "_items");
return_c_ident(fieldName); return_c_ident(fieldName);
} }
@ -690,8 +686,7 @@ abmfP_get_c_substruct_type_name(ABObj obj)
{ {
return NULL; return NULL;
} }
strcpy(typeName, ptrTypeName); snprintf(typeName, sizeof(typeName), "%sRec", ptrTypeName);
strcat(typeName, "Rec");
return_c_ident(typeName); return_c_ident(typeName);
} }
@ -729,7 +724,7 @@ abmfP_get_c_substruct_ptr_type_name(ABObj obj)
{ {
strcpy(ptrTypeName, typePrefixString); strcpy(ptrTypeName, typePrefixString);
strcat(ptrTypeName, 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, abmfP_capitalize_first_char(varName));
strcat(ptrTypeName, "Items"); strcat(ptrTypeName, "Items");
cvt_ident_to_type(ptrTypeName); cvt_ident_to_type(ptrTypeName);
@ -751,9 +746,7 @@ abmfP_get_clear_proc_name(ABObj obj)
{ {
return NULL; return NULL;
} }
strcpy(name, ptrTypeName); snprintf(name, sizeof(name), "%s_clear", ptrTypeName);
strcat(name, "_");
strcat(name, "clear");
return_c_ident(abmfP_uncapitalize_first_char(name)); return_c_ident(abmfP_uncapitalize_first_char(name));
} }
@ -823,7 +816,7 @@ abmfP_get_widget_name(ABObj obj)
name =abmfP_get_widget_name(objectObj); name =abmfP_get_widget_name(objectObj);
if ((name != NULL) && (name != nameBuf)) if ((name != NULL) && (name != nameBuf))
{ {
strcpy(nameBuf, name); snprintf(nameBuf, sizeof(nameBuf), "%s", name);
} }
if ((*nameBuf) != 0) if ((*nameBuf) != 0)
{ {
@ -861,6 +854,7 @@ STRING
abmfP_get_widget_name_for_res_file(ABObj obj) abmfP_get_widget_name_for_res_file(ABObj obj)
{ {
static char name[MAX_NAME_SIZE]; static char name[MAX_NAME_SIZE];
char nameTemp[sizeof(MAX_NAME_SIZE)];
*name = 0; *name = 0;
assert(abmfP_parent(obj) != NULL); 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, /* we can't use abmfP_get_widget_name twice in the same printf,
* because of the static string buffer. * because of the static string buffer.
*/ */
strcpy(name, abmfP_get_app_class_name(obj)); snprintf(nameTemp, sizeof(nameTemp), "%s*%s*",
strcat(name, "*"); abmfP_get_app_class_name(obj),
strcat(name, abmfP_get_widget_name(container)); abmfP_get_widget_name(container));
strcat(name, "*"); snprintf(name, sizeof(name), "%s%s",
strcat(name, abmfP_get_widget_name(obj)); nameTemp,
abmfP_get_widget_name(obj));
} }
return name; return name;
} }
@ -1042,6 +1037,7 @@ static STRING
abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize) abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize)
{ {
char tmpBuf[1024] = ""; char tmpBuf[1024] = "";
char tmpBuf2[1024] = "";
ABObj module= obj_get_module(obj); ABObj module= obj_get_module(obj);
if (module == NULL) if (module == NULL)
@ -1050,10 +1046,12 @@ abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize)
} }
else else
{ {
strcpy(tmpBuf, identPrefixString); /* Warning: Due to obj_get_name() returning a pointer to
strcat(tmpBuf, obj_get_name(module)); * static data this cannot be one snprintf() */
strcat(tmpBuf, "_"); snprintf(tmpBuf2, sizeof(tmpBuf2), "%s%s_",
strcat(tmpBuf, obj_get_name(obj)); identPrefixString, obj_get_name(module));
snprintf(tmpBuf, sizeof(tmpBuf), "%s%s",
tmpBuf2, obj_get_name(obj));
cvt_type_to_ident(tmpBuf, prefixBuf, prefixBufSize); 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); ABObj root_window= abmfP_get_root_window(project);
*root_widget_name = 0; *root_widget_name = 0;
strcpy(root_widget_name, abmfP_lib_get_toplevel_widget->name); snprintf(root_widget_name, sizeof(root_widget_name), "%s()", abmfP_lib_get_toplevel_widget->name);
strcat(root_widget_name, "()");
return root_widget_name; return root_widget_name;
} }
@ -1285,8 +1282,7 @@ abmfP_get_msg_clear_proc_name(ABObj msgObj)
{ {
static char name[MAX_NAME_SIZE]; static char name[MAX_NAME_SIZE];
strcpy(name, abmfP_get_c_struct_global_name(msgObj)); snprintf(name, sizeof(name), "%s_initialize", abmfP_get_c_struct_global_name(msgObj));
strcat(name, "_initialize");
return_c_ident(name); return_c_ident(name);
} }

View file

@ -471,7 +471,7 @@ write_map_window(
} }
else 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", abio_printf(codeFile, "%s(%s, %s);\n",
abmfP_get_init_proc_name(window), abmfP_get_init_proc_name(window),

View file

@ -401,7 +401,7 @@ set_up_user_type_variables(GenCodeInfo genCodeInfo, ABObj toObj)
} }
else else
{ {
strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent)); snprintf(winParentName, sizeof(winParentName), "%s", abmfP_get_c_name(genCodeInfo, winParent));
} }
/* /*

View file

@ -134,7 +134,7 @@ strip_spaces_and_dots(char *mname)
static char new_name[MAXPATHLEN]; static char new_name[MAXPATHLEN];
char *p; char *p;
strcpy(new_name, mname); snprintf(new_name, sizeof(new_name), "%s", mname);
p = (char *) strrchr(new_name, '.'); p = (char *) strrchr(new_name, '.');
if (p) if (p)
p = (char *) strrchr(p, '.'); p = (char *) strrchr(p, '.');
@ -1046,7 +1046,7 @@ write_call_user_post_create_procs(GenCodeInfo genCodeInfo, ABObj subObj)
if (targetObj == NULL) if (targetObj == NULL)
{ {
strcpy(targetStructPtrName, abmfP_str_null); snprintf(targetStructPtrName, sizeof(targetStructPtrName), "%s", abmfP_str_null);
} }
else else
{ {

View file

@ -108,7 +108,7 @@ abmfP_capitalize_first_char(STRING str)
if (str != name) /* if we get called w/our own buffer, don't copy */ 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]); 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 */ 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]); name[0] = tolower(str[0]);
@ -1295,6 +1295,8 @@ abmfP_obj_get_centering_type(ABObj obj)
if ((left_attach_type == AB_ATTACH_CENTER_GRIDLINE) && if ((left_attach_type == AB_ATTACH_CENTER_GRIDLINE) &&
(top_attach_type == AB_ATTACH_CENTER_GRIDLINE)) (top_attach_type == AB_ATTACH_CENTER_GRIDLINE))
return("DTB_CENTER_POSITION_BOTH"); return("DTB_CENTER_POSITION_BOTH");
return("DTB_CENTER_NONE");
} }
BOOL BOOL
@ -1335,6 +1337,8 @@ abmfP_obj_get_group_type(ABObj obj)
case AB_GROUP_ROWSCOLUMNS: case AB_GROUP_ROWSCOLUMNS:
return("DTB_GROUP_ROWSCOLUMNS"); return("DTB_GROUP_ROWSCOLUMNS");
} }
return("DTB_GROUP_NONE");
} }
STRING STRING

View file

@ -809,7 +809,7 @@ abmfP_write_create_proc_begin(
} }
int
abmfP_write_clear_proc_begin( abmfP_write_clear_proc_begin(
GenCodeInfo genCodeInfo, GenCodeInfo genCodeInfo,
ABObj obj ABObj obj
@ -827,6 +827,7 @@ abmfP_write_clear_proc_begin(
} }
int
abmfP_write_init_proc_decl( abmfP_write_init_proc_decl(
GenCodeInfo genCodeInfo, GenCodeInfo genCodeInfo,
ABObj obj ABObj obj
@ -857,9 +858,10 @@ abmfP_write_init_proc_decl(
NULL /* Argument name */ NULL /* Argument name */
); );
} }
return 0;
} }
int
abmfP_write_init_proc_begin( abmfP_write_init_proc_begin(
GenCodeInfo genCodeInfo, GenCodeInfo genCodeInfo,
ABObj obj ABObj obj

View file

@ -598,7 +598,7 @@ widget_into_module(
obj_set_name(ab_widget, ab_name); 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]); class_name[0] = tolower(class_name[0]);
strcat(class_name, CLASS_SUFFIX); strcat(class_name, CLASS_SUFFIX);
obj_set_class_name(ab_widget, class_name); obj_set_class_name(ab_widget, class_name);

View file

@ -227,8 +227,7 @@ suffixed(
if (widget_instance_name == NULL) if (widget_instance_name == NULL)
return(util_strsafe(widget_instance_name)); return(util_strsafe(widget_instance_name));
strcpy(buf, widget_instance_name); snprintf(buf, sizeof(buf), "%s%s", widget_instance_name, INSTANCE_SUFFIX);
strcat(buf, INSTANCE_SUFFIX);
return(buf); return(buf);
} }

View file

@ -1067,7 +1067,7 @@ bilP_load_att_label(BIL_TOKEN valueToken)
char filename[512]; char filename[512];
STRING ext; STRING ext;
strcpy(filename, istr_string(value)); snprintf(filename, sizeof(filename), "%s", istr_string(value));
if (util_file_name_has_extension(filename, "pm") || if (util_file_name_has_extension(filename, "pm") ||
util_file_name_has_extension(filename, "xpm") || util_file_name_has_extension(filename, "xpm") ||
util_file_name_has_extension(filename, "bm") || util_file_name_has_extension(filename, "bm") ||

View file

@ -1702,7 +1702,7 @@ store_attribute(
* Assume: indent char is tab * Assume: indent char is tab
*/ */
assert(abio_get_indent_char(outFile) == '\t'); 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); attrLen = strlen(attrbuf);
attrWidth = (abio_get_indent(outFile) * 8) + attrLen; attrWidth = (abio_get_indent(outFile) * 8) + attrLen;
firstWidthIter = TRUE; /* go through at least once */ firstWidthIter = TRUE; /* go through at least once */

View file

@ -2291,6 +2291,8 @@ load_att_stored_length(FILE * inFile, ABObj obj, ABObj root_obj)
{ {
obj_set_max_length(obj, tmp_int); obj_set_max_length(obj, tmp_int);
} }
return 0;
} }
/* /*

View file

@ -218,11 +218,9 @@ int
abil_print_load_err(int errmsg) abil_print_load_err(int errmsg)
{ {
static BOOL errmsg_tbl_init = FALSE; static BOOL errmsg_tbl_init = FALSE;
char msg[1024]; char msg[1024] = "";
int msgLen = 0; int msgLen = 0;
*msg = 0;
*msg = 0;
/* /*
** Load up the error message table if this is the first time we've ** Load up the error message table if this is the first time we've
** needed to output an error message. ** needed to output an error message.
@ -240,11 +238,11 @@ abil_print_load_err(int errmsg)
if (!abil_loadmsg_err_printed()) if (!abil_loadmsg_err_printed())
{ {
if(Errormsg[errmsg].msg_id < 0) { 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")); "syntax error"));
} }
else { else {
strcat(msg, snprintf(msg, sizeof(msg), "%s",
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET,
Errormsg[errmsg].msg_id, Errormsg[errmsg].msg_id,
Errormsg[errmsg].def_str)); Errormsg[errmsg].def_str));

View file

@ -3939,6 +3939,8 @@ obj_get_pane_min( ABObj obj)
return (obj->info.container.pane_min); return (obj->info.container.pane_min);
if (obj_is_layers(obj)) if (obj_is_layers(obj))
return (obj->info.layer.pane_min); return (obj->info.layer.pane_min);
return -1;
} }
int int
@ -3978,6 +3980,8 @@ obj_get_pane_max( ABObj obj)
return (obj->info.container.pane_max); return (obj->info.container.pane_max);
if (obj_is_layers(obj)) if (obj_is_layers(obj))
return (obj->info.layer.pane_max); return (obj->info.layer.pane_max);
return -1;
} }
int int

View file

@ -715,9 +715,9 @@ ab_ident_from_file_name(STRING filename)
if (filename != NULL) if (filename != NULL)
{ {
if (p = (char *) strrchr(filename, '/')) if (p = (char *) strrchr(filename, '/'))
strcpy(buf, p + 1); snprintf(buf, sizeof(buf), "%s", p + 1);
else else
strcpy(buf, filename); snprintf(buf, sizeof(buf), "%s", filename);
if (p = (char *) strrchr(buf, '.')) if (p = (char *) strrchr(buf, '.'))
*p = '\0'; *p = '\0';

View file

@ -431,7 +431,8 @@ objxm_xmstr_to_str(
while(XmStringGetNextSegment(context, &seg, while(XmStringGetNextSegment(context, &seg,
&char_set_tag, &dir, &sep)) &char_set_tag, &dir, &sep))
{ {
p += (strlen(strcpy(p, seg))); snprintf(p, sizeof(buf), "%s", seg);
p += (strlen(p));
if (sep == TRUE) if (sep == TRUE)
{ {
*p++ = '\n'; *p++ = '\n';

View file

@ -90,7 +90,7 @@ abio_expand_file(
/* /*
* Expand the file name and store to it. * 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) if (abio_expand_bil_module_path(Buf) == -1)
return -1; return -1;