dtappbuilder: Coverity fixes for mising return value and copy into fixed size buffer
authorPeter Howkins <flibble@users.sf.net>
Thu, 26 Apr 2018 00:36:02 +0000 (01:36 +0100)
committerPeter Howkins <flibble@users.sf.net>
Thu, 26 Apr 2018 00:36:02 +0000 (01:36 +0100)
29 files changed:
cde/programs/dtappbuilder/src/ab/abobj_list.c
cde/programs/dtappbuilder/src/ab/dtbuilder.c.src
cde/programs/dtappbuilder/src/ab/pal_menu.c
cde/programs/dtappbuilder/src/ab/palette_stubs.c
cde/programs/dtappbuilder/src/ab/projP_utils.c
cde/programs/dtappbuilder/src/ab/proj_utils.c
cde/programs/dtappbuilder/src/ab/prop.c
cde/programs/dtappbuilder/src/ab/prop_items.c
cde/programs/dtappbuilder/src/ab/ui_list.c
cde/programs/dtappbuilder/src/abmf/abmf.c
cde/programs/dtappbuilder/src/abmf/make_file.c
cde/programs/dtappbuilder/src/abmf/msg_cvt.c
cde/programs/dtappbuilder/src/abmf/msg_file.c
cde/programs/dtappbuilder/src/abmf/obj_names.c
cde/programs/dtappbuilder/src/abmf/proj_c_file.c
cde/programs/dtappbuilder/src/abmf/stubs_c_file.c
cde/programs/dtappbuilder/src/abmf/ui_c_file.c
cde/programs/dtappbuilder/src/abmf/utils.c
cde/programs/dtappbuilder/src/abmf/write_c.c
cde/programs/dtappbuilder/src/libABil/abuil_load.c
cde/programs/dtappbuilder/src/libABil/abuil_print.c
cde/programs/dtappbuilder/src/libABil/bil_loadatt.c
cde/programs/dtappbuilder/src/libABil/bil_store.c
cde/programs/dtappbuilder/src/libABil/gil_loadatt.c
cde/programs/dtappbuilder/src/libABil/load.c
cde/programs/dtappbuilder/src/libABobj/obj_fields.c
cde/programs/dtappbuilder/src/libABobj/obj_utils.c
cde/programs/dtappbuilder/src/libABobjXm/objxm_util.c
cde/programs/dtappbuilder/src/libAButil/abio_path.c

index 2bd608ad18da1d181f1d0e9526e6576008a7992d..de5c038d3a1eb433d9a8853a6a9b07ff01db8695 100644 (file)
@@ -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
index 9dd5af819797dccf809fcef59ab86d48333ff01c..de26697568a6f5ab86a6e0e6852108f973d39134 100644 (file)
@@ -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;
index 8b3551d6ec84aa132a07034bd188423636f402c8..448b66fd8acefcb901f2e8a7a6e3072c2a79a80f 100644 (file)
@@ -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 */
index 004bc6e5d4efa051a1a6b55520ed36678d10d733..4107c492172d2a04f0fd43bd0410218990c467fa 100644 (file)
@@ -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,
index 015bd25bc86f35327f1075b9368f4894510bfa04..e342e189b48cb73d82ce47f618036a3b917960cb 100644 (file)
@@ -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);
index 26e07808fb5a14b877ed5218f4e6eb919939683d..688bb4cf4132788dc5c96086b79f00a0d7aa9dc9 100644 (file)
@@ -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) )
index 9aec493c32d0a69a1530aae720cb6f07c0d614e0..346fcc40a15ec329b9c8332669afb2ee41d4948f 100644 (file)
@@ -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.
         */
index 14ac06abdc3b9a477abd0c70e43f06ddaa328986..a238a8b0cecc440be6d08c957d2b7d828c77ead3 100644 (file)
@@ -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;
index c99f97be37bbf390078683e6484aabb0d45ba685..c75a2b0de417641d3f7e533bd367172ad248afd4 100644 (file)
@@ -279,6 +279,8 @@ ui_list_replace_item_prefix(
            new_xmitem_array[0] = NULL;
        }
     }
+
+    return OK;
 }
 
 
index b2930a61c64bf59df5629dfcb5b79ed543c44677..b7f0a55c3075241e81b2140da6f4092e38a28327 100644 (file)
@@ -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");
index d57f4b75d9a5ccb16126043bd10f74ae69157ba6..a799fd674447feffd05de2f9ef8e32af142ef53b 100644 (file)
@@ -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;
 }
index 82953e64657fbff010de98883ca535a9519b3c62..d8b3b40ade4b4d4e32de143385d69ed8fc389e35 100644 (file)
@@ -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;
index 9d9a897a8504279d5e28577498f17e58a45d0c1b..8db878161a0ce8646147bc4617e835c145b5ed48 100644 (file)
@@ -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)
index 863abfdae1f2de8be0db6d512b4daddc9b56cba8..931f14453560559fb7c9ea57a0daa5afe50efd21 100644 (file)
@@ -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);
 }
index 7b461970b5a61f179910a8ca430777ed09b17658..700862fe13dbcfeef16acb75355c914a60cae37b 100644 (file)
@@ -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),
index ef66418ff3b26805918a4ebe8768b59d58d06cb1..afe200dbc8f4e315de8aa6a995c91c6742c187f0 100644 (file)
@@ -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));
     }
 
     /*
index 24bd947c7885b3f8918f94efa55f9c326a7e384b..950d64fe873ad6096c48a3861f07c2184ebb4046 100644 (file)
@@ -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
                {
index ed2731c60248c7faa5a622e454833d76d2b45476..d38361a78d964cdd329779c6c9dc1d3841f8612f 100644 (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 */
     {
-        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
index 0accd81194dbc981d3d03f92468997e67be7799a..28bd572e84c51ef849c3603dd8bdfe2e18de93a2 100644 (file)
@@ -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
index c14616f6b5768ae1b8458d1f0d7da5c8c56cf9cf..0d6ebd1c2daf32b69e6ac774b2c8c45c319a56ff 100644 (file)
@@ -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);
index db19e1abe01704426c9221f3e96e6cca6f5ba9b0..7c3c627ab4fd381e95e41bdb12660e4f533f7f96 100644 (file)
@@ -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);
 }
 
index a9a7e5459a66f89a7ef71ee5c572da5202746d93..f70d24bf8fe7d4d12047ba5f9410e40cbc40bb8b 100644 (file)
@@ -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") || 
index 6dff902665f1dc68e2c2e16114e02a6006bab249..1e0c0b387fa2c4b32f3633bc233a5b494f43e00e 100644 (file)
@@ -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 */
index 8aa1dc2f1cb8194ac8e0b3ce4adeedf0cb3b1dda..7d3902c28acb2f1bc514b923844e3d9d513535e3 100644 (file)
@@ -2291,6 +2291,8 @@ load_att_stored_length(FILE * inFile, ABObj obj, ABObj root_obj)
     {
        obj_set_max_length(obj, tmp_int);
     }
+    
+    return 0;
 }
 
 /*
index ac6356978f242a78cda68a306606cb0d3a2a865a..8665299e050f522f7dabe6d9c480b4f1119a099e 100644 (file)
@@ -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));
index 65c4032a674ea8312829b0c8443084707b18c61c..e0dd61ccd3157e38676ee2b5f7917d3ad6cd2543 100644 (file)
@@ -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
index bb34c5cb68d3e12b86234a008ef9588641ab6443..181504820d1b03b9bc1c937db78b8e6afd0679d1 100644 (file)
@@ -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';
index 263cdeb11817c662bb4420db778fafda29dedb2c..87ad435893fb75f74cfd2ddda040779de2841fa8 100644 (file)
@@ -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';
index d03746ffd837c75e154771338d5f75f28e1dd5c1..134207cb526b25859919aec58177da34b489860e 100644 (file)
@@ -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;