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

@@ -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);

View 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);
}

View 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") ||

View 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 */

View 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;
}
/*

View 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));