From b5dc13645494833696e27d9187cebe5d55532ef3 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 7 Mar 2022 21:46:17 -0600 Subject: [PATCH] Update: Switch to explicitly using sizeof() for char memset() and memcpy(). Different architectures might not actually have a 1-byte size. Rather than assuming the common behavior, always call sizeof(unsigned char) to determine size of memset() and mempcy() functions. --- level_0/f_account/c/account.c | 8 +-- level_0/f_account/c/private-account.c | 10 +-- level_0/f_capability/c/capability.c | 4 +- level_0/f_color/c/color.c | 70 +++++++++---------- level_0/f_directory/c/directory.c | 2 +- level_0/f_environment/c/environment.c | 2 +- level_0/f_file/c/file.c | 8 +-- level_0/f_file/c/private-file.c | 8 +-- level_0/f_path/c/path.c | 4 +- level_0/f_path/c/private-path.c | 2 +- level_0/f_serialize/c/serialize.c | 10 +-- level_0/f_string/c/private-string.c | 12 ++-- level_0/f_utf/c/utf.c | 8 +-- level_0/f_utf/c/utf/private-string.c | 14 ++-- level_1/fl_control_group/c/control_group.c | 6 +- level_1/fl_directory/c/directory.c | 2 +- level_1/fl_directory/c/private-directory.c | 42 ++++++------ level_1/fl_environment/c/environment.c | 4 +- level_1/fl_print/c/private-print.c | 4 +- level_1/fl_utf_file/c/private-utf_file.c | 2 +- level_2/fll_control_group/c/control_group.c | 4 +- level_2/fll_execute/c/execute.c | 4 +- level_2/fll_execute/c/private-execute.c | 4 +- level_2/fll_file/c/private-file.c | 16 ++--- level_2/fll_fss/c/fss/payload.c | 4 +- level_3/controller/c/control/private-control.c | 2 +- .../controller/c/controller/private-controller.c | 10 +-- level_3/controller/c/entry/private-entry.c | 16 ++--- level_3/controller/c/rule/private-rule.c | 16 ++--- level_3/fake/c/private-build-library.c | 78 +++++++++++----------- level_3/fake/c/private-build-load.c | 4 +- level_3/fake/c/private-build-object.c | 12 ++-- level_3/fake/c/private-build-objects.c | 14 ++-- level_3/fake/c/private-build-program.c | 20 +++--- level_3/fake/c/private-build-skeleton.c | 4 +- level_3/fake/c/private-build.c | 70 +++++++++---------- level_3/fake/c/private-make-operate_process_type.c | 8 +-- level_3/fake/c/private-make-operate_validate.c | 4 +- level_3/fake/c/private-skeleton.c | 6 +- level_3/firewall/c/firewall.c | 8 +-- level_3/firewall/c/private-firewall.c | 2 +- level_3/fss_embedded_list_read/c/private-read.c | 2 +- level_3/fss_payload_write/c/private-write.c | 4 +- 43 files changed, 267 insertions(+), 267 deletions(-) diff --git a/level_0/f_account/c/account.c b/level_0/f_account/c/account.c index 13c6d3d..4236c5c 100644 --- a/level_0/f_account/c/account.c +++ b/level_0/f_account/c/account.c @@ -297,7 +297,7 @@ extern "C" { macro_f_string_dynamic_t_resize(status, (*name), name_length + 1); if (F_status_is_error(status)) return status; - memcpy(name->string, group_data.gr_name, name_length); + memcpy(name->string, group_data.gr_name, sizeof(unsigned char) * name_length); name->string[name_length] = 0; name->used = name_length; @@ -332,7 +332,7 @@ extern "C" { macro_f_string_dynamic_t_resize(status, (*name), name_length + 1); if (F_status_is_error(status)) return status; - memcpy(name->string, group_data.gr_name, name_length); + memcpy(name->string, group_data.gr_name, sizeof(unsigned char) * name_length); name->string[name_length] = 0; name->used = name_length; @@ -471,7 +471,7 @@ extern "C" { macro_f_string_dynamic_t_resize(status, (*name), name_length + 1); if (F_status_is_error(status)) return status; - memcpy(name->string, password.pw_name, name_length); + memcpy(name->string, password.pw_name, sizeof(unsigned char) * name_length); name->string[name_length] = 0; name->used = name_length; @@ -506,7 +506,7 @@ extern "C" { macro_f_string_dynamic_t_resize(status, (*name), name_length + 1); if (F_status_is_error(status)) return status; - memcpy(name->string, password.pw_name, name_length); + memcpy(name->string, password.pw_name, sizeof(unsigned char) * name_length); name->string[name_length] = 0; name->used = name_length; diff --git a/level_0/f_account/c/private-account.c b/level_0/f_account/c/private-account.c index 307d207..88ad944 100644 --- a/level_0/f_account/c/private-account.c +++ b/level_0/f_account/c/private-account.c @@ -20,7 +20,7 @@ extern "C" { status = f_string_dynamic_resize(string_length + 1, &account->home); if (F_status_is_error(status)) return status; - memcpy(account->home.string, password.pw_dir, string_length); + memcpy(account->home.string, password.pw_dir, sizeof(unsigned char) * string_length); account->home.string[string_length] = 0; account->home.used = string_length; @@ -31,7 +31,7 @@ extern "C" { status = f_string_dynamic_resize(string_length + 1, &account->label); if (F_status_is_error(status)) return status; - memcpy(account->label.string, password.pw_gecos, string_length); + memcpy(account->label.string, password.pw_gecos, sizeof(unsigned char) * string_length); account->label.string[string_length] = 0; account->label.used = string_length; @@ -42,7 +42,7 @@ extern "C" { status = f_string_dynamic_resize(string_length + 1, &account->name); if (F_status_is_error(status)) return status; - memcpy(account->name.string, password.pw_name, string_length); + memcpy(account->name.string, password.pw_name, sizeof(unsigned char) * string_length); account->name.string[string_length] = 0; account->name.used = string_length; @@ -53,7 +53,7 @@ extern "C" { status = f_string_dynamic_resize(string_length + 1, &account->password); if (F_status_is_error(status)) return status; - memcpy(account->password.string, password.pw_passwd, string_length); + memcpy(account->password.string, password.pw_passwd, sizeof(unsigned char) * string_length); account->password.string[string_length] = 0; account->password.used = string_length; @@ -64,7 +64,7 @@ extern "C" { status = f_string_dynamic_resize(string_length + 1, &account->shell); if (F_status_is_error(status)) return status; - memcpy(account->shell.string, password.pw_shell, string_length); + memcpy(account->shell.string, password.pw_shell, sizeof(unsigned char) * string_length); account->shell.string[string_length] = 0; account->shell.used = string_length; diff --git a/level_0/f_capability/c/capability.c b/level_0/f_capability/c/capability.c index 3c302b9..ac52941 100644 --- a/level_0/f_capability/c/capability.c +++ b/level_0/f_capability/c/capability.c @@ -1067,7 +1067,7 @@ extern "C" { } } - memcpy(name->string + name->used, result, length); + memcpy(name->string + name->used, result, sizeof(unsigned char) * length); name->used += length; name->string[name->used] = 0; @@ -1108,7 +1108,7 @@ extern "C" { } } - memcpy(text->string + text->used, result, length); + memcpy(text->string + text->used, result, sizeof(unsigned char) * length); text->used += length; text->string[text->used] = 0; diff --git a/level_0/f_color/c/color.c b/level_0/f_color/c/color.c index b79f05c..f2b9e12 100644 --- a/level_0/f_color/c/color.c +++ b/level_0/f_color/c/color.c @@ -123,19 +123,19 @@ extern "C" { if (F_status_is_error(status)) return status; if (format.begin.used) { - memcpy(buffer->string + buffer->used, format.begin.string, format.begin.used); + memcpy(buffer->string + buffer->used, format.begin.string, sizeof(unsigned char) * format.begin.used); buffer->used += format.begin.used; } if (color1.used) { - memcpy(buffer->string + buffer->used, color1.string, color1.used); + memcpy(buffer->string + buffer->used, color1.string, sizeof(unsigned char) * color1.used); buffer->used += color1.used; } if (format.end.used) { - memcpy(buffer->string + buffer->used, format.end.string, format.end.used); + memcpy(buffer->string + buffer->used, format.end.string, sizeof(unsigned char) * format.end.used); buffer->used += format.end.used; } @@ -158,31 +158,31 @@ extern "C" { if (F_status_is_error(status)) return status; if (format.begin.used) { - memcpy(buffer->string + buffer->used, format.begin.string, format.begin.used); + memcpy(buffer->string + buffer->used, format.begin.string, sizeof(unsigned char) * format.begin.used); buffer->used += format.begin.used; } if (color1.used) { - memcpy(buffer->string + buffer->used, color1.string, color1.used); + memcpy(buffer->string + buffer->used, color1.string, sizeof(unsigned char) * color1.used); buffer->used += color1.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color2.used) { - memcpy(buffer->string + buffer->used, color2.string, color2.used); + memcpy(buffer->string + buffer->used, color2.string, sizeof(unsigned char) * color2.used); buffer->used += color2.used; } if (format.end.used) { - memcpy(buffer->string + buffer->used, format.end.string, format.end.used); + memcpy(buffer->string + buffer->used, format.end.string, sizeof(unsigned char) * format.end.used); buffer->used += format.end.used; } @@ -205,43 +205,43 @@ extern "C" { if (F_status_is_error(status)) return status; if (format.begin.used) { - memcpy(buffer->string + buffer->used, format.begin.string, format.begin.used); + memcpy(buffer->string + buffer->used, format.begin.string, sizeof(unsigned char) * format.begin.used); buffer->used += format.begin.used; } if (color1.used) { - memcpy(buffer->string + buffer->used, color1.string, color1.used); + memcpy(buffer->string + buffer->used, color1.string, sizeof(unsigned char) * color1.used); buffer->used += color1.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color2.used) { - memcpy(buffer->string + buffer->used, color2.string, color2.used); + memcpy(buffer->string + buffer->used, color2.string, sizeof(unsigned char) * color2.used); buffer->used += color2.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color3.used) { - memcpy(buffer->string + buffer->used, color3.string, color3.used); + memcpy(buffer->string + buffer->used, color3.string, sizeof(unsigned char) * color3.used); buffer->used += color3.used; } if (format.end.used) { - memcpy(buffer->string + buffer->used, format.end.string, format.end.used); + memcpy(buffer->string + buffer->used, format.end.string, sizeof(unsigned char) * format.end.used); buffer->used += format.end.used; } @@ -264,55 +264,55 @@ extern "C" { if (F_status_is_error(status)) return status; if (format.begin.used) { - memcpy(buffer->string + buffer->used, format.begin.string, format.begin.used); + memcpy(buffer->string + buffer->used, format.begin.string, sizeof(unsigned char) * format.begin.used); buffer->used += format.begin.used; } if (color1.used) { - memcpy(buffer->string + buffer->used, color1.string, color1.used); + memcpy(buffer->string + buffer->used, color1.string, sizeof(unsigned char) * color1.used); buffer->used += color1.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color2.used) { - memcpy(buffer->string + buffer->used, color2.string, color2.used); + memcpy(buffer->string + buffer->used, color2.string, sizeof(unsigned char) * color2.used); buffer->used += color2.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color3.used) { - memcpy(buffer->string + buffer->used, color3.string, color3.used); + memcpy(buffer->string + buffer->used, color3.string, sizeof(unsigned char) * color3.used); buffer->used += color3.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color4.used) { - memcpy(buffer->string + buffer->used, color4.string, color4.used); + memcpy(buffer->string + buffer->used, color4.string, sizeof(unsigned char) * color4.used); buffer->used += color4.used; } if (format.end.used) { - memcpy(buffer->string + buffer->used, format.end.string, format.end.used); + memcpy(buffer->string + buffer->used, format.end.string, sizeof(unsigned char) * format.end.used); buffer->used += format.end.used; } @@ -335,67 +335,67 @@ extern "C" { if (F_status_is_error(status)) return status; if (format.begin.used) { - memcpy(buffer->string + buffer->used, format.begin.string, format.begin.used); + memcpy(buffer->string + buffer->used, format.begin.string, sizeof(unsigned char) * format.begin.used); buffer->used += format.begin.used; } if (color1.used) { - memcpy(buffer->string + buffer->used, color1.string, color1.used); + memcpy(buffer->string + buffer->used, color1.string, sizeof(unsigned char) * color1.used); buffer->used += color1.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color2.used) { - memcpy(buffer->string + buffer->used, color2.string, color2.used); + memcpy(buffer->string + buffer->used, color2.string, sizeof(unsigned char) * color2.used); buffer->used += color2.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color3.used) { - memcpy(buffer->string + buffer->used, color3.string, color3.used); + memcpy(buffer->string + buffer->used, color3.string, sizeof(unsigned char) * color3.used); buffer->used += color3.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color4.used) { - memcpy(buffer->string + buffer->used, color4.string, color4.used); + memcpy(buffer->string + buffer->used, color4.string, sizeof(unsigned char) * color4.used); buffer->used += color4.used; } if (format.medium.used) { - memcpy(buffer->string + buffer->used, format.medium.string, format.medium.used); + memcpy(buffer->string + buffer->used, format.medium.string, sizeof(unsigned char) * format.medium.used); buffer->used += format.medium.used; } if (color5.used) { - memcpy(buffer->string + buffer->used, color5.string, color5.used); + memcpy(buffer->string + buffer->used, color5.string, sizeof(unsigned char) * color5.used); buffer->used += color5.used; } if (format.end.used) { - memcpy(buffer->string + buffer->used, format.end.string, format.end.used); + memcpy(buffer->string + buffer->used, format.end.string, sizeof(unsigned char) * format.end.used); buffer->used += format.end.used; } diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index f3ba1a8..0b0af33 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -203,7 +203,7 @@ extern "C" { status = f_string_dynamic_increase_by(size, &names->array[names->used]); if (F_status_is_error(status)) break; - memcpy(names->array[names->used].string, listing[i]->d_name, size); + memcpy(names->array[names->used].string, listing[i]->d_name, sizeof(unsigned char) * size); names->array[names->used++].used = size; f_memory_delete(size, sizeof(unsigned char *), (void **) & listing[i]); diff --git a/level_0/f_environment/c/environment.c b/level_0/f_environment/c/environment.c index 5598b65..0a39c82 100644 --- a/level_0/f_environment/c/environment.c +++ b/level_0/f_environment/c/environment.c @@ -52,7 +52,7 @@ extern "C" { const f_status_t status = f_string_dynamic_increase_by(size + 1, value); if (F_status_is_error(status)) return status; - memcpy(value->string + value->used, result, size); + memcpy(value->string + value->used, result, sizeof(unsigned char) * size); value->used += size; value->string[value->used] = 0; diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 6d213d7..d9a5c58 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1395,7 +1395,7 @@ extern "C" { unsigned char path_argument[path.used + 1]; f_string_t path_to_name; - memcpy(path_argument, path.string, path.used); + memcpy(path_argument, path.string, sizeof(unsigned char) * path.used); path_argument[path.used] = 0; path_to_name = basename(path_argument); @@ -1405,7 +1405,7 @@ extern "C" { const f_status_t status = f_string_dynamic_increase_by(size + 1, name_base); if (F_status_is_error(status)) return status; - memcpy(name_base->string + name_base->used, path_to_name, size); + memcpy(name_base->string + name_base->used, path_to_name, sizeof(unsigned char) * size); name_base->used += size; name_base->string[name_base->used] = 0; @@ -1427,7 +1427,7 @@ extern "C" { unsigned char path_argument[path.used + 1]; f_string_t path_to_name; - memcpy(path_argument, path.string, path.used); + memcpy(path_argument, path.string, sizeof(unsigned char) * path.used); path_argument[path.used] = 0; path_to_name = dirname(path_argument); @@ -1444,7 +1444,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(name_directory->string + name_directory->used, path_to_name, size); + memcpy(name_directory->string + name_directory->used, path_to_name, sizeof(unsigned char) * size); name_directory->used += size; name_directory->string[name_directory->used] = 0; diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index b1ced97..0c078b3 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -62,7 +62,7 @@ extern "C" { ssize_t size_write = 0; unsigned char *buffer[size_block]; - memset(buffer, 0, size_block); + memset(buffer, 0, sizeof(unsigned char) * size_block); while ((size_read = read(file_source.id, buffer, size_block)) > 0) { @@ -111,7 +111,7 @@ extern "C" { ssize_t size_write = 0; unsigned char *buffer[size_block]; - memset(buffer, 0, size_block); + memset(buffer, 0, sizeof(unsigned char) * size_block); while ((size_read = read(file_source.id, buffer, size_block)) > 0) { @@ -416,7 +416,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memset(target->string, 0, target->used + 1); + memset(target->string, 0, sizeof(unsigned char) * (target->used + 1)); target->used = link_stat.st_size; @@ -453,7 +453,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memset(target->string, 0, target->used + 1); + memset(target->string, 0, sizeof(unsigned char) * (target->used + 1)); target->used = link_stat.st_size; diff --git a/level_0/f_path/c/path.c b/level_0/f_path/c/path.c index 817ac54..85ea51c 100644 --- a/level_0/f_path/c/path.c +++ b/level_0/f_path/c/path.c @@ -82,7 +82,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(path->string, buffer, length); + memcpy(path->string, buffer, sizeof(unsigned char) * length); path->string[length] = 0; path->used = length; @@ -140,7 +140,7 @@ extern "C" { } // while // Use memcpy() to take advantage of its optimized copy behaviors whenever possible. - memcpy(directory->string + directory->used, argument.string + i, j - i); + memcpy(directory->string + directory->used, argument.string + i, sizeof(unsigned char) * (j - i)); directory->used += j - i; i = j; diff --git a/level_0/f_path/c/private-path.c b/level_0/f_path/c/private-path.c index 2b78028..d246947 100644 --- a/level_0/f_path/c/private-path.c +++ b/level_0/f_path/c/private-path.c @@ -32,7 +32,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(real->string, buffer, length); + memcpy(real->string, buffer, sizeof(unsigned char) * length); real->string[length] = 0; real->used = length; diff --git a/level_0/f_serialize/c/serialize.c b/level_0/f_serialize/c/serialize.c index a3ddc65..4efa17c 100644 --- a/level_0/f_serialize/c/serialize.c +++ b/level_0/f_serialize/c/serialize.c @@ -19,12 +19,12 @@ extern "C" { } if (!serialize->used) { - memcpy(serialize->string + serialize->used, value.string, value.used); + memcpy(serialize->string + serialize->used, value.string, sizeof(unsigned char) * value.used); serialize->used += value.used; } else { - memcpy(serialize->string + serialize->used, f_serialize_simple_splitter_s.string, f_serialize_simple_splitter_s.used); - memcpy(serialize->string + serialize->used + f_serialize_simple_splitter_s.used, value.string, value.used); + memcpy(serialize->string + serialize->used, f_serialize_simple_splitter_s.string, sizeof(unsigned char) * f_serialize_simple_splitter_s.used); + memcpy(serialize->string + serialize->used + f_serialize_simple_splitter_s.used, value.string, sizeof(unsigned char) * value.used); serialize->used += value.used + 1; } @@ -78,7 +78,7 @@ extern "C" { strings->array[strings->used].size = total; } - memcpy(strings->array[strings->used].string, serialize.string + start, total); + memcpy(strings->array[strings->used].string, serialize.string + start, sizeof(unsigned char) * total); strings->array[strings->used].used = total; ++strings->used; @@ -195,7 +195,7 @@ extern "C" { if (F_status_is_error(status_allocation)) return status_allocation; } - memcpy(dynamic->string, serialize.string + range.start, total); + memcpy(dynamic->string, serialize.string + range.start, sizeof(unsigned char) * total); dynamic->used = total; return status; diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 56b6bbe..cce5280 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -13,7 +13,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source, length); + memcpy(destination->string + destination->used, source, sizeof(unsigned char) * length); destination->used += length; destination->string[destination->used] = 0; @@ -48,7 +48,7 @@ extern "C" { if (i && i > first) { size = i - first; - memcpy(destination->string + destination->used, source + first, size); + memcpy(destination->string + destination->used, source + first, sizeof(unsigned char) * size); destination->used += size; } @@ -62,7 +62,7 @@ extern "C" { if (i > first) { size = i - first; - memcpy(destination->string + destination->used, source + first, size); + memcpy(destination->string + destination->used, source + first, sizeof(unsigned char) * size); destination->used += size; } @@ -661,10 +661,10 @@ extern "C" { if (destination->used) { memmove(destination->string + length, destination->string, destination->used); - memcpy(destination->string, source, length); + memcpy(destination->string, source, sizeof(unsigned char) * length); } else { - memcpy(destination->string, source, length); + memcpy(destination->string, source, sizeof(unsigned char) * length); } destination->used += length; @@ -718,7 +718,7 @@ extern "C" { } memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, size); + memcpy(destination->string + offset, source + first, sizeof(unsigned char) * size); destination->used += size; offset += size; diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index e3a26c6..c11bb62 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -694,9 +694,9 @@ extern "C" { return F_status_set_error(F_failure); } - memcpy(*character, &utf, macro_f_utf_character_t_width_is(utf_character)); + memcpy(*character, &utf, sizeof(unsigned char) * macro_f_utf_character_t_width_is(utf_character)); #else - memcpy(*character, &utf_character, macro_f_utf_character_t_width_is(utf_character)); + memcpy(*character, &utf_character, sizeof(unsigned char) * macro_f_utf_character_t_width_is(utf_character)); #endif // __BYTE_ORDER == __LITTLE_ENDIAN return F_none; @@ -705,9 +705,9 @@ extern "C" { #if __BYTE_ORDER == __LITTLE_ENDIAN uint32_t utf = macro_f_utf_character_t_to_char_1(utf_character) << 24; - memcpy(*character, &utf, 1); + memcpy(*character, &utf, sizeof(unsigned char)); #else - memcpy(*character, &utf_character, 1); + memcpy(*character, &utf_character, sizeof(unsigned char)); #endif // __BYTE_ORDER == __LITTLE_ENDIAN return F_none; diff --git a/level_0/f_utf/c/utf/private-string.c b/level_0/f_utf/c/utf/private-string.c index ca8b242..1a45f52 100644 --- a/level_0/f_utf/c/utf/private-string.c +++ b/level_0/f_utf/c/utf/private-string.c @@ -13,7 +13,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source, length); + memcpy(destination->string + destination->used, source, sizeof(unsigned char) * length); destination->used = destination->used + length; return F_none; @@ -45,7 +45,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + first, size); + memcpy(destination->string + destination->used, source + first, sizeof(unsigned char) * size); destination->used = destination->used + size; } @@ -64,7 +64,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + first, size); + memcpy(destination->string + destination->used, source + first, sizeof(unsigned char) * size); destination->used = destination->used + size; } @@ -344,10 +344,10 @@ extern "C" { if (destination->used) { memmove(destination->string + length, destination->string, destination->used); - memcpy(destination->string, source, length); + memcpy(destination->string, source, sizeof(unsigned char) * length); } else { - memcpy(destination->string, source, length); + memcpy(destination->string, source, sizeof(unsigned char) * length); } destination->used = destination->used + length; @@ -381,7 +381,7 @@ extern "C" { } memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, size); + memcpy(destination->string + offset, source + first, sizeof(unsigned char) * size); destination->used = destination->used + size; offset += size; @@ -401,7 +401,7 @@ extern "C" { } memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, size); + memcpy(destination->string + offset, source + first, sizeof(unsigned char) * size); destination->used = destination->used + size; offset += size; diff --git a/level_1/fl_control_group/c/control_group.c b/level_1/fl_control_group/c/control_group.c index 787132d..ef685cc 100644 --- a/level_1/fl_control_group/c/control_group.c +++ b/level_1/fl_control_group/c/control_group.c @@ -35,11 +35,11 @@ extern "C" { path.string = path_string; if (control_group.path.used) { - memcpy(path.string, control_group.path.string, control_group.path.used); + memcpy(path.string, control_group.path.string, sizeof(unsigned char) * control_group.path.used); } - memcpy(path.string + control_group.path.used, control_group.groups.array[i].string, control_group.groups.array[i].used); - memcpy(path.string + control_group.path.used + F_control_group_path_system_default_s_length, F_control_group_path_system_suffix_s, F_control_group_path_system_suffix_s_length); + memcpy(path.string + control_group.path.used, control_group.groups.array[i].string, sizeof(unsigned char) * control_group.groups.array[i].used); + memcpy(path.string + control_group.path.used + F_control_group_path_system_default_s_length, F_control_group_path_system_suffix_s, sizeof(unsigned char) * F_control_group_path_system_suffix_s_length); path.string[path.used] = 0; diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 9cdefcd..8df9af2 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -35,7 +35,7 @@ extern "C" { for (; at_path < path.used; ++at_path) { if (at_path && path.string[at_path] == f_path_separator_s.string[0]) { - memcpy(tree.string, path.string + at_tree, at_path - at_tree); + memcpy(tree.string, path.string + at_tree, sizeof(unsigned char) * (at_path - at_tree)); tree.string[at_path - at_tree] = 0; status = f_directory_exists(tree); diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 7a3e817..9009d4c 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -61,11 +61,11 @@ extern "C" { unsigned char path_source_sub[source_sub.used + 1]; unsigned char path_destination_sub[destination_sub.used + 1]; - memcpy(path_source_sub, source.string, source.used); - memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_source_sub, source.string, sizeof(unsigned char) * source.used); + memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); - memcpy(path_destination_sub, destination.string, destination.used); - memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_destination_sub, destination.string, sizeof(unsigned char) * destination.used); + memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); path_source_sub[source.used] = f_path_separator_s.string[0]; path_source_sub[source_sub.used] = 0; @@ -152,13 +152,13 @@ extern "C" { path_source.string = path_source_string; path_destination.string = path_destination_string; - memcpy(path_source_string, source.string, source.used); - memcpy(path_source_string + source.used + 1, file.string, file.used); + memcpy(path_source_string, source.string, sizeof(unsigned char) * source.used); + memcpy(path_source_string + source.used + 1, file.string, sizeof(unsigned char) * file.used); path_source_string[source.used] = f_path_separator_s.string[0]; path_source_string[source.used + file.used + 1] = 0; - memcpy(path_destination_string, destination.string, destination.used); - memcpy(path_destination_string + destination.used + 1, file.string, file.used); + memcpy(path_destination_string, destination.string, sizeof(unsigned char) * destination.used); + memcpy(path_destination_string + destination.used + 1, file.string, sizeof(unsigned char) * file.used); path_destination_string[destination.used] = f_path_separator_s.string[0]; path_destination_string[destination.used + file.used + 1] = 0; @@ -196,7 +196,7 @@ extern "C" { macro_f_directory_status_t_resize(status, failure, size + 1); if (F_status_is_error(status)) return status; - memcpy(failure.path.string, path_source.string, size); + memcpy(failure.path.string, path_source.string, sizeof(unsigned char) * size); failure.path.string[size] = 0; } else { @@ -210,7 +210,7 @@ extern "C" { macro_f_directory_status_t_resize(status, failure, size + 1); if (F_status_is_error(status)) return status; - memcpy(failure.path.string, path_destination.string, size); + memcpy(failure.path.string, path_destination.string, sizeof(unsigned char) * size); failure.path.string[size] = 0; } @@ -286,11 +286,11 @@ extern "C" { unsigned char path_source_sub[source_sub.used + 1]; unsigned char path_destination_sub[destination_sub.used + 1]; - memcpy(path_source_sub, source.string, source.used); - memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_source_sub, source.string, sizeof(unsigned char) * source.used); + memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); memcpy(path_destination_sub, destination.string, destination.used); - memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); path_source_sub[source.used] = f_path_separator_s.string[0]; path_source_sub[source_sub.used] = 0; @@ -364,13 +364,13 @@ extern "C" { path_source.string = path_source_string; path_destination.string = path_destination_string; - memcpy(path_source_string, source.string, source.used); - memcpy(path_source_string + source.used + 1, file.string, file.used); + memcpy(path_source_string, source.string, sizeof(unsigned char) * source.used); + memcpy(path_source_string + source.used + 1, file.string, sizeof(unsigned char) * file.used); path_source_string[source.used] = f_path_separator_s.string[0]; path_source_string[source.used + file.used + 1] = 0; - memcpy(path_destination_string, destination.string, destination.used); - memcpy(path_destination_string + destination.used + 1, file.string, file.used); + memcpy(path_destination_string, destination.string, sizeof(unsigned char) * destination.used); + memcpy(path_destination_string + destination.used + 1, file.string, sizeof(unsigned char) * file.used); path_destination_string[destination.used] = f_path_separator_s.string[0]; path_destination_string[destination.used + file.used + 1] = 0; @@ -411,7 +411,7 @@ extern "C" { macro_f_directory_status_t_resize(status, failure, size + 1); if (F_status_is_error(status)) return status; - memcpy(failure.path.string, path_source.string, size); + memcpy(failure.path.string, path_source.string, sizeof(unsigned char) * size); failure.path.string[size] = 0; } else { @@ -425,7 +425,7 @@ extern "C" { macro_f_directory_status_t_resize(status, failure, size + 1); if (F_status_is_error(status)) return status; - memcpy(failure.path.string, path_destination.string, size); + memcpy(failure.path.string, path_destination.string, sizeof(unsigned char) * size); failure.path.string[size] = 0; } @@ -549,7 +549,7 @@ extern "C" { status = f_string_dynamic_increase_by(name_directory.used, &names->array[names->used]); if (F_status_is_error(status)) break; - memcpy(names->array[names->used].string, name_directory.string, name_directory.used); + memcpy(names->array[names->used].string, name_directory.string, sizeof(unsigned char) * name_directory.used); names->array[names->used++].used = name_directory.used; f_memory_resize(1, 0, sizeof(unsigned char *), (void **) & entity[i]); @@ -762,7 +762,7 @@ extern "C" { } if (length_truncated - start > 0) { - memcpy(destination->string + destination->used, source.string + start, length_truncated - start); + memcpy(destination->string + destination->used, source.string + start, sizeof(unsigned char) * (length_truncated - start)); } destination->used += total; diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 7e860ad..665aaa8 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -139,7 +139,7 @@ extern "C" { status = f_string_dynamic_increase_by(k, &paths->array[paths->used]); if (F_status_is_error(status)) return status; - memcpy(paths->array[paths->used].string, buffer, k); + memcpy(paths->array[paths->used].string, buffer, sizeof(unsigned char) * k); paths->array[paths->used++].used = k; } @@ -217,7 +217,7 @@ extern "C" { status = f_string_dynamic_increase_by(k, &paths->array[paths->used]); if (F_status_is_error(status)) return status; - memcpy(paths->array[paths->used].string, buffer, k); + memcpy(paths->array[paths->used].string, buffer, sizeof(unsigned char) * k); paths->array[paths->used++].used = k; } diff --git a/level_1/fl_print/c/private-print.c b/level_1/fl_print/c/private-print.c index 31884ab..bea8429 100644 --- a/level_1/fl_print/c/private-print.c +++ b/level_1/fl_print/c/private-print.c @@ -1085,8 +1085,8 @@ extern "C" { unsigned char format[33]; unsigned char buffer[129]; - memset(format, 0, 33); - memset(buffer, 0, 129); + memset(format, 0, sizeof(unsigned char) * 33); + memset(buffer, 0, sizeof(unsigned char) * 129); format[f++] = f_string_ascii_percent_s.string[0]; diff --git a/level_1/fl_utf_file/c/private-utf_file.c b/level_1/fl_utf_file/c/private-utf_file.c index f8e7bc2..fe733d9 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -93,7 +93,7 @@ extern "C" { // @todo this needs to identify an invalid UTF-8 string before writing and return an error if invalid. do { - memset(buffer_write, 0, write_size); + memset(buffer_write, 0, sizeof(unsigned char) * write_size); for (i = 0, used = 0; used < write_size && *written + i < write_max; ++i, used += width) { diff --git a/level_2/fll_control_group/c/control_group.c b/level_2/fll_control_group/c/control_group.c index 6a5b9fe..f545c24 100644 --- a/level_2/fll_control_group/c/control_group.c +++ b/level_2/fll_control_group/c/control_group.c @@ -30,10 +30,10 @@ extern "C" { path.string = path_string; if (control_group.path.used) { - memcpy(path.string, control_group.path.string, control_group.path.used); + memcpy(path.string, control_group.path.string, sizeof(unsigned char) * control_group.path.used); } - memcpy(path.string + control_group.path.used, control_group.groups.array[i].string, control_group.groups.array[i].used); + memcpy(path.string + control_group.path.used, control_group.groups.array[i].string, sizeof(unsigned char) * control_group.groups.array[i].used); path.string[path.used] = 0; status = fl_directory_create(path, F_file_mode_all_rwx_d); diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 8b781bf..55500b5 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -190,7 +190,7 @@ extern "C" { unsigned char program_path[found->used + 1]; program_path[found->used] = 0; - memcpy(&program_path, found->string, found->used); + memcpy(&program_path, found->string, sizeof(unsigned char) * found->used); f_string_dynamics_resize(0, &paths); @@ -382,7 +382,7 @@ extern "C" { unsigned char program_path[found->used + 1]; program_path[found->used] = 0; - memcpy(&program_path, found->string, found->used); + memcpy(&program_path, found->string, sizeof(unsigned char) * found->used); program_name.string = program_path; program_name.used = found->used; diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 8235e1f..0295136 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -565,10 +565,10 @@ extern "C" { #if !defined(_di_fll_execute_program_) void private_fll_execute_path_arguments_fixate(const f_string_static_t program_path, const f_string_statics_t arguments, const f_string_t last_slash, const bool fixated_is, f_string_static_t program_name, f_string_t fixed_arguments[]) { - memset(program_name.string, 0, program_name.used + 1); + memset(program_name.string, 0, sizeof(unsigned char) * (program_name.used + 1)); memset(fixed_arguments, 0, sizeof(f_string_t) * (arguments.used + 2)); - memcpy(program_name.string, last_slash ? last_slash + 1 : program_path.string, program_name.used); + memcpy(program_name.string, last_slash ? last_slash + 1 : program_path.string, sizeof(unsigned char) * program_name.used); if (program_name.used) { fixed_arguments[0] = program_name.string; diff --git a/level_2/fll_file/c/private-file.c b/level_2/fll_file/c/private-file.c index 6fba958..598adfc 100644 --- a/level_2/fll_file/c/private-file.c +++ b/level_2/fll_file/c/private-file.c @@ -53,8 +53,8 @@ extern "C" { unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; - memcpy(path_sub.string, path.string, path.used); - memcpy(path_sub.string + path.used + 1, list[i]->array[j].string, list[i]->array[j].used); + memcpy(path_sub.string, path.string, sizeof(unsigned char) * path.used); + memcpy(path_sub.string + path.used + 1, list[i]->array[j].string, sizeof(unsigned char) * list[i]->array[j].used); path_sub.string[path.used] = f_path_separator_s.string[0]; path_sub.string[path_sub.used] = 0; @@ -77,8 +77,8 @@ extern "C" { unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; - memcpy(path_sub.string, path.string, path.used); - memcpy(path_sub.string + path.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_sub.string, path.string, sizeof(unsigned char) * path.used); + memcpy(path_sub.string + path.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); path_sub.string[path.used] = f_path_separator_s.string[0]; path_sub.string[path_sub.used] = 0; @@ -155,8 +155,8 @@ extern "C" { unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; - memcpy(path_sub.string, path.string, path.used); - memcpy(path_sub.string + path.used + 1, list[i]->array[j].string, list[i]->array[j].used); + memcpy(path_sub.string, path.string, sizeof(unsigned char) * path.used); + memcpy(path_sub.string + path.used + 1, list[i]->array[j].string, sizeof(unsigned char) * list[i]->array[j].used); path_sub.string[path.used] = f_path_separator_s.string[0]; path_sub.string[path_sub.used] = 0; @@ -178,8 +178,8 @@ extern "C" { unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; - memcpy(path_sub.string, path.string, path.used); - memcpy(path_sub.string + path.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); + memcpy(path_sub.string, path.string, sizeof(unsigned char) * path.used); + memcpy(path_sub.string + path.used + 1, listing.directory.array[i].string, sizeof(unsigned char) * listing.directory.array[i].used); path_sub.string[path.used] = f_path_separator_s.string[0]; path_sub.string[path_sub.used] = 0; diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index 3656957..3f695bc 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -209,11 +209,11 @@ extern "C" { } } - memcpy(destination->string + destination->used + i, content.string + i, F_fss_default_block_size_normal_d); + memcpy(destination->string + destination->used + i, content.string + i, sizeof(unsigned char) * F_fss_default_block_size_normal_d); } // for if (i < content.used) { - memcpy(destination->string + destination->used + i, content.string + i, content.used - i); + memcpy(destination->string + destination->used + i, content.string + i, sizeof(unsigned char) * (content.used - i)); } destination->used += content.used; diff --git a/level_3/controller/c/control/private-control.c b/level_3/controller/c/control/private-control.c index d7fb7bf..f362fc8 100644 --- a/level_3/controller/c/control/private-control.c +++ b/level_3/controller/c/control/private-control.c @@ -38,7 +38,7 @@ extern "C" { unsigned char buffer[controller_control_default_socket_buffer_d + 1]; size_t length = 0; - memset(buffer, 0, controller_control_default_socket_buffer_d + 1); + memset(buffer, 0, sizeof(unsigned char) * (controller_control_default_socket_buffer_d + 1)); // Pre-process the packet header. control->client.size_read = controller_control_default_socket_header_d; diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index 2f1667b..631d05e 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -78,13 +78,13 @@ extern "C" { path.string = path_string; if (global.setting->path_setting.used) { - memcpy(path_string, global.setting->path_setting.string, global.setting->path_setting.used); - memcpy(path_string + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, cache->action.name_file.used); + memcpy(path_string, global.setting->path_setting.string, sizeof(unsigned char) * global.setting->path_setting.used); + memcpy(path_string + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(unsigned char) * cache->action.name_file.used); path_string[global.setting->path_setting.used] = f_path_separator_s.string[0]; } else { - memcpy(path_string, cache->action.name_file.string, cache->action.name_file.used); + memcpy(path_string, cache->action.name_file.string, sizeof(unsigned char) * cache->action.name_file.used); } path_string[path.used] = 0; @@ -371,8 +371,8 @@ extern "C" { unsigned char temporary[--length]; temporary[length] = 0; - memcpy(temporary, destination->string + setting->path_current.used + 1, length); - memcpy(destination->string, temporary, length); + memcpy(temporary, destination->string + setting->path_current.used + 1, sizeof(unsigned char) * length); + memcpy(destination->string, temporary, sizeof(unsigned char) * length); destination->string[length] = 0; destination->used = length; diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 82c8f41..8dbc021 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -1195,8 +1195,8 @@ extern "C" { unsigned char id_rule_name[id_rule_length + 1]; const f_string_static_t alias_rule = macro_f_string_static_t_initialize2(id_rule_name, id_rule_length); - memcpy(id_rule_name, entry_action->parameters.array[0].string, entry_action->parameters.array[0].used); - memcpy(id_rule_name + entry_action->parameters.array[0].used + 1, entry_action->parameters.array[1].string, entry_action->parameters.array[1].used); + memcpy(id_rule_name, entry_action->parameters.array[0].string, sizeof(unsigned char) * entry_action->parameters.array[0].used); + memcpy(id_rule_name + entry_action->parameters.array[0].used + 1, entry_action->parameters.array[1].string, sizeof(unsigned char) * entry_action->parameters.array[1].used); id_rule_name[entry_action->parameters.array[0].used] = f_path_separator_s.string[0]; id_rule_name[id_rule_length] = 0; @@ -1255,9 +1255,9 @@ extern "C" { unsigned char cache_name_item[cache_name_item_used]; unsigned char cache_name_file[cache_name_file_used]; - memcpy(cache_name_action, cache->action.name_action.string, cache->action.name_action.used); - memcpy(cache_name_item, cache->action.name_item.string, cache->action.name_item.used); - memcpy(cache_name_file, cache->action.name_file.string, cache->action.name_file.used); + memcpy(cache_name_action, cache->action.name_action.string, sizeof(unsigned char) * cache->action.name_action.used); + memcpy(cache_name_item, cache->action.name_item.string, sizeof(unsigned char) * cache->action.name_item.used); + memcpy(cache_name_file, cache->action.name_file.string, sizeof(unsigned char) * cache->action.name_file.used); status_lock = controller_lock_write(is_entry, global->thread, &global->thread->lock.rule); @@ -1266,9 +1266,9 @@ extern "C" { } // Restore cache. - memcpy(cache->action.name_action.string, cache_name_action, cache_name_action_used); - memcpy(cache->action.name_item.string, cache_name_item, cache_name_item_used); - memcpy(cache->action.name_file.string, cache_name_file, cache_name_file_used); + memcpy(cache->action.name_action.string, cache_name_action, sizeof(unsigned char) * cache_name_action_used); + memcpy(cache->action.name_item.string, cache_name_item, sizeof(unsigned char) * cache_name_item_used); + memcpy(cache->action.name_file.string, cache_name_file, sizeof(unsigned char) * cache_name_file_used); cache->action.name_action.string[cache_name_action_used] = 0; cache->action.name_item.string[cache_name_item_used] = 0; diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 6ad3ddf..13f4ce1 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -2061,7 +2061,7 @@ extern "C" { unsigned char buffer_string[buffer.used + 1]; - memcpy(buffer_string, source.string + content.start, buffer.used); + memcpy(buffer_string, source.string + content.start, sizeof(unsigned char) * buffer.used); buffer_string[buffer.used] = 0; buffer.string = buffer_string; process->cache.action.generic.used = 0; @@ -2246,8 +2246,8 @@ extern "C" { unsigned char buffer_string[buffer.used]; buffer.string = buffer_string; - memcpy(buffer_string, options[i].string, options[i].used); - memcpy(buffer_string + options[i].used, controller_parameter_map_option_s.string, controller_parameter_map_option_s.used); + memcpy(buffer_string, options[i].string, sizeof(unsigned char) * options[i].used); + memcpy(buffer_string + options[i].used, controller_parameter_map_option_s.string, sizeof(unsigned char) * controller_parameter_map_option_s.used); if (fl_string_dynamic_partial_compare_string(buffer.string, source, buffer.used, content) == F_equal_to) { if (values[i] && parameters->array[codes[i]].result == f_console_result_additional_e || !values[i] && parameters->array[codes[i]].result == f_console_result_found_e) { @@ -2272,8 +2272,8 @@ extern "C" { unsigned char buffer_string[buffer.used]; buffer.string = buffer_string; - memcpy(buffer_string, options[i].string, options[i].used); - memcpy(buffer_string + options[i].used, controller_parameter_map_value_s.string, controller_parameter_map_value_s.used); + memcpy(buffer_string, options[i].string, sizeof(unsigned char) * options[i].used); + memcpy(buffer_string + options[i].used, controller_parameter_map_value_s.string, sizeof(unsigned char) * controller_parameter_map_value_s.used); if (fl_string_dynamic_partial_compare_string(buffer.string, source, buffer.used, content) == F_equal_to) { if (parameters->array[codes[i]].result == f_console_result_additional_e) { @@ -2884,7 +2884,7 @@ extern "C" { unsigned char alias_other_buffer_string[alias_other_buffer.used + 1]; alias_other_buffer.string = alias_other_buffer_string; - memcpy(alias_other_buffer_string, global.setting->rules.array[id_rule].alias.string, alias_other_buffer.used); + memcpy(alias_other_buffer_string, global.setting->rules.array[id_rule].alias.string, sizeof(unsigned char) * alias_other_buffer.used); alias_other_buffer_string[alias_other_buffer.used] = 0; f_thread_unlock(&global.thread->lock.rule); @@ -4007,7 +4007,7 @@ extern "C" { unsigned char name_item[length_name_item]; name_item[length_name_item] = 0; - memcpy(name_item, cache->action.name_item.string, length_name_item); + memcpy(name_item, cache->action.name_item.string, sizeof(unsigned char) * length_name_item); for (; i < cache->content_actions.used; ++i, type = 0) { @@ -5700,7 +5700,7 @@ extern "C" { } // for // Restore the current name item and line number, which there should already be enough allocated space for. - memcpy(cache->action.name_item.string, name_item, length_name_item); + memcpy(cache->action.name_item.string, name_item, sizeof(unsigned char) * length_name_item); cache->action.name_item.string[length_name_item] = 0; cache->action.name_item.used = length_name_item; diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 3e10c57..d4ec735 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -114,21 +114,21 @@ extern "C" { for (; i < strings_length; ++i) { - memcpy(strings[i]->string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + memcpy(strings[i]->string, fake_build_parameter_library_name_prefix_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_prefix_s.used); strings[i]->used += fake_build_parameter_library_name_prefix_s.used; } // for for (i = 0; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); strings[i]->used += data_build->setting.build_name.used; } // for for (i = 0; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + memcpy(strings[i]->string + strings[i]->used, fake_build_parameter_library_name_suffix_shared_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_suffix_shared_s.used); strings[i]->used += fake_build_parameter_library_name_suffix_shared_s.used; } // for @@ -137,7 +137,7 @@ extern "C" { if (data_build->setting.version_major_prefix.used) { for (i = 1; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_major_prefix.string, data_build->setting.version_major_prefix.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_major_prefix.string, sizeof(unsigned char) * data_build->setting.version_major_prefix.used); strings[i]->used += data_build->setting.version_major_prefix.used; } // for @@ -145,7 +145,7 @@ extern "C" { for (i = 1; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_major.string, data_build->setting.version_major.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_major.string, sizeof(unsigned char) * data_build->setting.version_major.used); strings[i]->used += data_build->setting.version_major.used; } // for @@ -154,7 +154,7 @@ extern "C" { if (data_build->setting.version_minor_prefix.used) { for (i = 2; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_minor_prefix.string, data_build->setting.version_minor_prefix.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_minor_prefix.string, sizeof(unsigned char) * data_build->setting.version_minor_prefix.used); strings[i]->used += data_build->setting.version_minor_prefix.used; } // for @@ -162,7 +162,7 @@ extern "C" { for (i = 2; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_minor.string, data_build->setting.version_minor.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_minor.string, sizeof(unsigned char) * data_build->setting.version_minor.used); strings[i]->used += data_build->setting.version_minor.used; } // for @@ -171,7 +171,7 @@ extern "C" { if (data_build->setting.version_micro_prefix.used) { for (i = 3; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_micro_prefix.string, data_build->setting.version_micro_prefix.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_micro_prefix.string, sizeof(unsigned char) * data_build->setting.version_micro_prefix.used); strings[i]->used += data_build->setting.version_micro_prefix.used; } // for @@ -179,7 +179,7 @@ extern "C" { for (i = 3; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_micro.string, data_build->setting.version_micro.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_micro.string, sizeof(unsigned char) * data_build->setting.version_micro.used); strings[i]->used += data_build->setting.version_micro.used; } // for @@ -188,7 +188,7 @@ extern "C" { if (data_build->setting.version_nano_prefix.used) { for (i = 4; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_nano_prefix.string, data_build->setting.version_nano_prefix.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_nano_prefix.string, sizeof(unsigned char) * data_build->setting.version_nano_prefix.used); strings[i]->used += data_build->setting.version_nano_prefix.used; } // for @@ -196,7 +196,7 @@ extern "C" { for (i = 4; i < strings_length; ++i) { - memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_nano.string, data_build->setting.version_nano.used); + memcpy(strings[i]->string + strings[i]->used, data_build->setting.version_nano.string, sizeof(unsigned char) * data_build->setting.version_nano.used); strings[i]->used += data_build->setting.version_nano.used; } // for @@ -254,33 +254,33 @@ extern "C" { parameter_file_path_string[parameter_file_path.used] = 0; parameter_linker_string[parameter_linker.used] = 0; - memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_linker_string, fake_build_parameter_library_shared_prefix_s.string, fake_build_parameter_library_shared_prefix_s.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); + memcpy(parameter_linker_string, fake_build_parameter_library_shared_prefix_s.string, sizeof(unsigned char) * fake_build_parameter_library_shared_prefix_s.used); if (data_build->setting.version_file == fake_build_version_type_major_e) { - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major_string, parameter_file_name_major.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major_string, sizeof(unsigned char) * parameter_file_name_major.used); } else if (data_build->setting.version_file == fake_build_version_type_minor_e) { - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor_string, parameter_file_name_minor.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor_string, sizeof(unsigned char) * parameter_file_name_minor.used); } else if (data_build->setting.version_file == fake_build_version_type_micro_e) { - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro_string, parameter_file_name_micro.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro_string, sizeof(unsigned char) * parameter_file_name_micro.used); } else if (data_build->setting.version_file == fake_build_version_type_nano_e) { - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_nano_string, parameter_file_name_nano.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_nano_string, sizeof(unsigned char) * parameter_file_name_nano.used); } if (data_build->setting.version_target == fake_build_version_type_major_e) { - memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_major_string, parameter_file_name_major.used); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_major_string, sizeof(unsigned char) * parameter_file_name_major.used); } else if (data_build->setting.version_target == fake_build_version_type_minor_e) { - memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_minor_string, parameter_file_name_minor.used); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_minor_string, sizeof(unsigned char) * parameter_file_name_minor.used); } else if (data_build->setting.version_target == fake_build_version_type_micro_e) { - memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_micro_string, parameter_file_name_micro.used); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_micro_string, sizeof(unsigned char) * parameter_file_name_micro.used); } else if (data_build->setting.version_target == fake_build_version_type_nano_e) { - memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_nano_string, parameter_file_name_nano.used); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_nano_string, sizeof(unsigned char) * parameter_file_name_nano.used); } const f_string_static_t values[] = { @@ -326,8 +326,8 @@ extern "C" { parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; - memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name.string, parameter_file_name.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name.string, sizeof(unsigned char) * parameter_file_name.used); *status = f_file_link(parameter_file_name_major, parameter_file_path); @@ -357,8 +357,8 @@ extern "C" { parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; - memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major.string, parameter_file_name_major.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major.string, sizeof(unsigned char) * parameter_file_name_major.used); *status = f_file_link(parameter_file_name_minor, parameter_file_path); @@ -386,8 +386,8 @@ extern "C" { parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; - memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor.string, parameter_file_name_minor.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor.string, sizeof(unsigned char) * parameter_file_name_minor.used); *status = f_file_link(parameter_file_name_micro, parameter_file_path); @@ -414,8 +414,8 @@ extern "C" { parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; - memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro.string, parameter_file_name_micro.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro.string, sizeof(unsigned char) * parameter_file_name_micro.used); *status = f_file_link(parameter_file_name_nano, parameter_file_path); @@ -477,16 +477,16 @@ extern "C" { destination_string[destination.used] = 0; destination.used = 0; - memcpy(destination_string, main->path_build_libraries_static.string, main->path_build_libraries_static.used); + memcpy(destination_string, main->path_build_libraries_static.string, sizeof(unsigned char) * main->path_build_libraries_static.used); destination.used += main->path_build_libraries_static.used; - memcpy(destination_string + destination.used, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + memcpy(destination_string + destination.used, fake_build_parameter_library_name_prefix_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_prefix_s.used); destination.used += fake_build_parameter_library_name_prefix_s.used; - memcpy(destination_string + destination.used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(destination_string + destination.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); destination.used += data_build->setting.build_name.used; - memcpy(destination_string + destination.used, fake_build_parameter_library_name_suffix_static_s.string, fake_build_parameter_library_name_suffix_static_s.used); + memcpy(destination_string + destination.used, fake_build_parameter_library_name_suffix_static_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_suffix_static_s.used); destination.used += fake_build_parameter_library_name_suffix_static_s.used; *status = fll_execute_arguments_add(destination, &arguments); @@ -551,14 +551,14 @@ extern "C" { source_string[source.used] = 0; if (source_path.used) { - memcpy(source_string, source_path.string, source_path.used); - memcpy(source_string + source_path.used, file_name.string, file_name.used); - memcpy(source_string + source_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(source_string, source_path.string, sizeof(unsigned char) * source_path.used); + memcpy(source_string + source_path.used, file_name.string, sizeof(unsigned char) * file_name.used); + memcpy(source_string + source_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); } else { - memcpy(source_string, main->path_build_objects.string, main->path_build_objects.used); - memcpy(source_string + main->path_build_objects.used, file_name.string, file_name.used); - memcpy(source_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(source_string, main->path_build_objects.string, sizeof(unsigned char) * main->path_build_objects.used); + memcpy(source_string + main->path_build_objects.used, file_name.string, sizeof(unsigned char) * file_name.used); + memcpy(source_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); } *status = fll_execute_arguments_add(source, &arguments); diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index e1b29ad..b583528 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -95,8 +95,8 @@ extern "C" { f_fss_contents_t contents = f_fss_contents_t_initialize; if (setting_file.used) { - memcpy(path_file_string, main->path_data_build.string, main->path_data_build.used); - memcpy(path_file_string + main->path_data_build.used, setting_file.string, setting_file.used); + memcpy(path_file_string, main->path_data_build.string, sizeof(unsigned char) * main->path_data_build.used); + memcpy(path_file_string + main->path_data_build.used, setting_file.string, sizeof(unsigned char) * setting_file.used); *status = fake_file_buffer(main, path_file, &buffer); } diff --git a/level_3/fake/c/private-build-object.c b/level_3/fake/c/private-build-object.c index 394e541..5453bfc 100644 --- a/level_3/fake/c/private-build-object.c +++ b/level_3/fake/c/private-build-object.c @@ -51,9 +51,9 @@ extern "C" { parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; - memcpy(parameter_file_name_path_string, main->path_build_objects_shared.string, main->path_build_objects_shared.used); - memcpy(parameter_file_name_path_string + main->path_build_objects_shared.used, data_build->setting.build_name.string, data_build->setting.build_name.used); - memcpy(parameter_file_name_path_string + main->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(parameter_file_name_path_string, main->path_build_objects_shared.string, sizeof(unsigned char) * main->path_build_objects_shared.used); + memcpy(parameter_file_name_path_string + main->path_build_objects_shared.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); + memcpy(parameter_file_name_path_string + main->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); const f_string_static_t values[] = { fake_build_parameter_object_compile_s, @@ -122,9 +122,9 @@ extern "C" { parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; - memcpy(parameter_file_name_path_string, main->path_build_objects_static.string, main->path_build_objects_static.used); - memcpy(parameter_file_name_path_string + main->path_build_objects_static.used, data_build->setting.build_name.string, data_build->setting.build_name.used); - memcpy(parameter_file_name_path_string + main->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(parameter_file_name_path_string, main->path_build_objects_static.string, sizeof(unsigned char) * main->path_build_objects_static.used); + memcpy(parameter_file_name_path_string + main->path_build_objects_static.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); + memcpy(parameter_file_name_path_string + main->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); const f_string_static_t values[] = { fake_build_parameter_object_compile_s, diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index 6af0f27..8422571 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -64,7 +64,7 @@ extern "C" { fake_build_path_source_string(main, data_build, &data_build->setting.path_sources, &source); - memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used); + memcpy(source_string + source.used, sources[i]->array[j].string, sizeof(unsigned char) * sources[i]->array[j].used); source.used += sources[i]->array[j].used; source.string[source.used] = 0; @@ -161,14 +161,14 @@ extern "C" { destination_string[destination.used] = 0; if (destination_path.used) { - memcpy(destination_string, destination_path.string, destination_path.used); - memcpy(destination_string + destination_path.used, file_name.string, file_name.used); - memcpy(destination_string + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(destination_string, destination_path.string, sizeof(unsigned char) * destination_path.used); + memcpy(destination_string + destination_path.used, file_name.string, sizeof(unsigned char) * file_name.used); + memcpy(destination_string + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); } else { - memcpy(destination_string, main->path_build_objects.string, main->path_build_objects.used); - memcpy(destination_string + main->path_build_objects.used, file_name.string, file_name.used); - memcpy(destination_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); + memcpy(destination_string, main->path_build_objects.string, sizeof(unsigned char) * main->path_build_objects.used); + memcpy(destination_string + main->path_build_objects.used, file_name.string, sizeof(unsigned char) * file_name.used); + memcpy(destination_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(unsigned char) * fake_build_parameter_object_name_suffix_s.used); } const f_string_static_t values[] = { diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index 04088b4..54a4f35 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -61,8 +61,8 @@ extern "C" { parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; - memcpy(parameter_file_name_path_string, main->path_build_programs_shared.string, main->path_build_programs_shared.used); - memcpy(parameter_file_name_path_string + main->path_build_programs_shared.used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(parameter_file_name_path_string, main->path_build_programs_shared.string, sizeof(unsigned char) * main->path_build_programs_shared.used); + memcpy(parameter_file_name_path_string + main->path_build_programs_shared.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); const f_string_static_t values[] = { fake_build_parameter_library_output_s, @@ -87,8 +87,8 @@ extern "C" { link_project_library.string = link_project_library_string; link_project_library_string[link_project_library.used] = 0; - memcpy(link_project_library_string, fake_build_parameter_library_link_file_s.string, fake_build_parameter_library_link_file_s.used); - memcpy(link_project_library_string + fake_build_parameter_library_link_file_s.used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(link_project_library_string, fake_build_parameter_library_link_file_s.string, sizeof(unsigned char) * fake_build_parameter_library_link_file_s.used); + memcpy(link_project_library_string + fake_build_parameter_library_link_file_s.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); *status = fll_execute_arguments_add(link_project_library, &arguments); } @@ -158,16 +158,16 @@ extern "C" { // Only include the library if there are sources that would result in it being built. if (data_build->setting.build_sources_library.used) { - memcpy(source_library_string, main->path_build_libraries_static.string, main->path_build_libraries_static.used); + memcpy(source_library_string, main->path_build_libraries_static.string, sizeof(unsigned char) * main->path_build_libraries_static.used); source_library.used += main->path_build_libraries_static.used; - memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_prefix_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_prefix_s.used); source_library.used += fake_build_parameter_library_name_prefix_s.used; - memcpy(source_library_string + source_library.used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(source_library_string + source_library.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); source_library.used += data_build->setting.build_name.used; - memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_suffix_static_s.string, fake_build_parameter_library_name_suffix_static_s.used); + memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_suffix_static_s.string, sizeof(unsigned char) * fake_build_parameter_library_name_suffix_static_s.used); source_library.used += fake_build_parameter_library_name_suffix_static_s.used; } @@ -178,8 +178,8 @@ extern "C" { parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; - memcpy(parameter_file_name_path_string, main->path_build_programs_static.string, main->path_build_programs_static.used); - memcpy(parameter_file_name_path_string + main->path_build_programs_static.used, data_build->setting.build_name.string, data_build->setting.build_name.used); + memcpy(parameter_file_name_path_string, main->path_build_programs_static.string, sizeof(unsigned char) * main->path_build_programs_static.used); + memcpy(parameter_file_name_path_string + main->path_build_programs_static.used, data_build->setting.build_name.string, sizeof(unsigned char) * data_build->setting.build_name.used); const f_string_static_t values[] = { source_library, diff --git a/level_3/fake/c/private-build-skeleton.c b/level_3/fake/c/private-build-skeleton.c index 9746224..9b3f76d 100644 --- a/level_3/fake/c/private-build-skeleton.c +++ b/level_3/fake/c/private-build-skeleton.c @@ -22,8 +22,8 @@ extern "C" { path_headers.string = path_headers_string; if (data_build->setting.path_headers.used) { - memcpy(path_headers_string, main->path_build_includes.string, main->path_build_includes.used); - memcpy(path_headers_string + main->path_build_includes.used, data_build->setting.path_headers.string, data_build->setting.path_headers.used); + memcpy(path_headers_string, main->path_build_includes.string, sizeof(unsigned char) * main->path_build_includes.used); + memcpy(path_headers_string + main->path_build_includes.used, data_build->setting.path_headers.string, sizeof(unsigned char) * data_build->setting.path_headers.used); } else { path_headers.used = 0; diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index e631b7f..645dfbd 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -33,13 +33,13 @@ extern "C" { unsigned char build_libraries[build_libraries_length + 1]; - memcpy(build_libraries, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); + memcpy(build_libraries, fake_build_parameter_library_link_path_s.string, sizeof(unsigned char) * fake_build_parameter_library_link_path_s.used); if (is_shared) { - memcpy(build_libraries + fake_build_parameter_library_link_path_s.used, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(build_libraries + fake_build_parameter_library_link_path_s.used, main->path_build_libraries_shared.string, sizeof(unsigned char) * main->path_build_libraries_shared.used); } else { - memcpy(build_libraries + fake_build_parameter_library_link_path_s.used, main->path_build_libraries_static.string, main->path_build_libraries_static.used); + memcpy(build_libraries + fake_build_parameter_library_link_path_s.used, main->path_build_libraries_static.string, sizeof(unsigned char) * main->path_build_libraries_static.used); } build_libraries[build_libraries_length] = 0; @@ -48,8 +48,8 @@ extern "C" { unsigned char build_includes[build_includes_length + 1]; - memcpy(build_includes, fake_build_parameter_library_include_s.string, fake_build_parameter_library_include_s.used); - memcpy(build_includes + fake_build_parameter_library_include_s.used, main->path_build_includes.string, main->path_build_includes.used); + memcpy(build_includes, fake_build_parameter_library_include_s.string, sizeof(unsigned char) * fake_build_parameter_library_include_s.used); + memcpy(build_includes + fake_build_parameter_library_include_s.used, main->path_build_includes.string, sizeof(unsigned char) * main->path_build_includes.used); const f_string_static_t values[] = { macro_f_string_static_t_initialize(build_libraries, 0, build_libraries_length), @@ -75,8 +75,8 @@ extern "C" { buffer.string = buffer_string; buffer_string[buffer.used] = 0; - memcpy(buffer_string, fake_build_parameter_library_include_s.string, fake_build_parameter_library_include_s.used); - memcpy(buffer_string + fake_build_parameter_library_include_s.used, main->path_work_includes.string, main->path_work_includes.used); + memcpy(buffer_string, fake_build_parameter_library_include_s.string, sizeof(unsigned char) * fake_build_parameter_library_include_s.used); + memcpy(buffer_string + fake_build_parameter_library_include_s.used, main->path_work_includes.string, sizeof(unsigned char) * main->path_work_includes.used); *status = fll_execute_arguments_add(buffer, arguments); } @@ -88,8 +88,8 @@ extern "C" { buffer.string = buffer_string; buffer_string[buffer.used] = 0; - memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); - memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_shared.string, main->path_work_libraries_shared.used); + memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, sizeof(unsigned char) * fake_build_parameter_library_link_path_s.used); + memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_shared.string, sizeof(unsigned char) * main->path_work_libraries_shared.used); *status = fll_execute_arguments_add(buffer, arguments); } @@ -101,8 +101,8 @@ extern "C" { buffer.string = buffer_string; buffer_string[buffer.used] = 0; - memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); - memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_static.string, main->path_work_libraries_static.used); + memcpy(buffer_string, fake_build_parameter_library_link_path_s.string, sizeof(unsigned char) * fake_build_parameter_library_link_path_s.used); + memcpy(buffer_string + fake_build_parameter_library_link_path_s.used, main->path_work_libraries_static.string, sizeof(unsigned char) * main->path_work_libraries_static.used); *status = fll_execute_arguments_add(buffer, arguments); } @@ -374,7 +374,7 @@ extern "C" { return; } - memcpy(path_source.string, source.string, source.used); + memcpy(path_source.string, source.string, sizeof(unsigned char) * source.used); fl_directory_recurse_t recurse = fl_directory_recurse_t_initialize; @@ -561,16 +561,16 @@ extern "C" { argument.string = argument_string; argument_string[argument.used] = 0; - memcpy(argument_string, f_console_symbol_short_disable_s.string, f_console_symbol_short_disable_s.used); + memcpy(argument_string, f_console_symbol_short_disable_s.string, sizeof(unsigned char) * f_console_symbol_short_disable_s.used); if (main->context.mode == F_color_mode_dark_d) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_dark_s.string, f_console_standard_short_dark_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_dark_s.string, sizeof(unsigned char) * f_console_standard_short_dark_s.used); } else if (main->context.mode == F_color_mode_light_d) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_light_s.string, f_console_standard_short_light_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_light_s.string, sizeof(unsigned char) * f_console_standard_short_light_s.used); } else if (main->context.mode == F_color_mode_no_color_d) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_no_color_s.string, f_console_standard_short_no_color_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_no_color_s.string, sizeof(unsigned char) * f_console_standard_short_no_color_s.used); } *status = fll_execute_arguments_add(argument, &arguments); @@ -585,16 +585,16 @@ extern "C" { argument.string = argument_string; argument_string[argument.used] = 0; - memcpy(argument_string, f_console_symbol_short_disable_s.string, f_console_symbol_short_disable_s.used); + memcpy(argument_string, f_console_symbol_short_disable_s.string, sizeof(unsigned char) * f_console_symbol_short_disable_s.used); if (main->context.mode == f_console_verbosity_quiet_e) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_quiet_s.string, f_console_standard_short_quiet_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_quiet_s.string, sizeof(unsigned char) * f_console_standard_short_quiet_s.used); } else if (main->context.mode == f_console_verbosity_verbose_e) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_verbose_s.string, f_console_standard_short_verbose_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_verbose_s.string, sizeof(unsigned char) * f_console_standard_short_verbose_s.used); } else if (main->context.mode == f_console_verbosity_debug_e) { - memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_debug_s.string, f_console_standard_short_debug_s.used); + memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_debug_s.string, sizeof(unsigned char) * f_console_standard_short_debug_s.used); } *status = fll_execute_arguments_add(argument, &arguments); @@ -790,8 +790,8 @@ extern "C" { source.string = source_string; source_string[source.used] = 0; - memcpy(source_string, path->string, path->used); - memcpy(source_string + path->used, sources[i]->array[j].string, sources[i]->array[j].used); + memcpy(source_string, path->string, sizeof(unsigned char) * path->used); + memcpy(source_string + path->used, sources[i]->array[j].string, sizeof(unsigned char) * sources[i]->array[j].used); status = fll_execute_arguments_add(source, arguments); if (F_status_is_error(status)) return status; @@ -858,7 +858,7 @@ extern "C" { fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source); - memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used); + memcpy(source_string + source.used, fake_path_part_script_s.string, sizeof(unsigned char) * fake_path_part_script_s.used); source.used += fake_path_part_script_s.used; source.string[source.used] = 0; @@ -882,10 +882,10 @@ extern "C" { unsigned char path_headers_string[path_headers.used + 1]; path_headers.string = path_headers_string; - memcpy(path_headers_string, main->path_build_includes.string, main->path_build_includes.used); + memcpy(path_headers_string, main->path_build_includes.string, sizeof(unsigned char) * main->path_build_includes.used); if (data_build.setting.path_headers.used) { - memcpy(path_headers_string + main->path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); + memcpy(path_headers_string + main->path_build_includes.used, data_build.setting.path_headers.string, sizeof(unsigned char) * data_build.setting.path_headers.used); } path_headers_string[path_headers.used] = 0; @@ -929,7 +929,7 @@ extern "C" { fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source); - memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used); + memcpy(source_string + source.used, fake_path_part_script_s.string, sizeof(unsigned char) * fake_path_part_script_s.used); source.used += fake_path_part_script_s.used; source.string[source.used] = 0; @@ -976,27 +976,27 @@ extern "C" { source->used = 0; - memcpy(source->string, main->path_sources.string, main->path_sources.used); + memcpy(source->string, main->path_sources.string, sizeof(unsigned char) * main->path_sources.used); source->used += main->path_sources.used; - memcpy(source->string + source->used, setting_path_source->string, setting_path_source->used); + memcpy(source->string + source->used, setting_path_source->string, sizeof(unsigned char) * setting_path_source->used); source->used += setting_path_source->used; if (data_build->setting.has_path_standard) { if (data_build->setting.build_language == fake_build_language_type_c_e) { - memcpy(source->string + source->used, fake_build_language_c_s.string, fake_build_language_c_s.used); + memcpy(source->string + source->used, fake_build_language_c_s.string, sizeof(unsigned char) * fake_build_language_c_s.used); source->used += fake_build_language_c_s.used; } else if (data_build->setting.build_language == fake_build_language_type_cpp_e) { - memcpy(source->string + source->used, fake_build_language_cpp_s.string, fake_build_language_cpp_s.used); + memcpy(source->string + source->used, fake_build_language_cpp_s.string, sizeof(unsigned char) * fake_build_language_cpp_s.used); source->used += fake_build_language_cpp_s.used; } else if (data_build->setting.build_language == fake_build_language_type_bash_e) { - memcpy(source->string + source->used, fake_build_language_bash_s.string, fake_build_language_bash_s.used); + memcpy(source->string + source->used, fake_build_language_bash_s.string, sizeof(unsigned char) * fake_build_language_bash_s.used); source->used += fake_build_language_bash_s.used; } - memcpy(source->string + source->used, f_path_separator_s.string, f_path_separator_s.used); + memcpy(source->string + source->used, f_path_separator_s.string, sizeof(unsigned char) * f_path_separator_s.used); source->used += f_path_separator_s.used; } @@ -1031,7 +1031,7 @@ extern "C" { fake_build_path_source_string(main, data_build, &data_build->setting.path_sources, &source); - memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used); + memcpy(source_string + source.used, sources[i]->array[j].string, sizeof(unsigned char) * sources[i]->array[j].used); source.used += sources[i]->array[j].used; source.string[source.used] = 0; @@ -1066,11 +1066,11 @@ extern "C" { fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source); if (specific->used) { - memcpy(source_string + source.used, specific->string, specific->used); + memcpy(source_string + source.used, specific->string, sizeof(unsigned char) * specific->used); source.used += specific->used; } else { - memcpy(source_string + source.used, generic->string, generic->used); + memcpy(source_string + source.used, generic->string, sizeof(unsigned char) * generic->used); source.used += generic->used; } diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index 8c65dd1..4eeafc8 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -69,10 +69,10 @@ extern "C" { destination.string = destination_string; destination_string[destination.used] = 0; - memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); + memcpy(destination_string, arguments.array[total].string, sizeof(unsigned char) * arguments.array[total].used); if (existing) { - memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); + memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, sizeof(unsigned char) * arguments.array[i].used); destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } @@ -1060,10 +1060,10 @@ extern "C" { destination.string = destination_string; destination_string[destination.used] = 0; - memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); + memcpy(destination_string, arguments.array[total].string, sizeof(unsigned char) * arguments.array[total].used); if (existing) { - memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); + memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, sizeof(unsigned char) * arguments.array[i].used); destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index fdcb0f5..4537b73 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -86,8 +86,8 @@ extern "C" { path_file.string = path_file_string; path_file_string[path_file.used] = 0; - memcpy(path_file_string, data_make->main->path_data_build.string, data_make->main->path_data_build.used); - memcpy(path_file_string + data_make->main->path_data_build.used, arguments.array[0].string, arguments.array[0].used); + memcpy(path_file_string, data_make->main->path_data_build.string, sizeof(unsigned char) * data_make->main->path_data_build.used); + memcpy(path_file_string + data_make->main->path_data_build.used, arguments.array[0].string, sizeof(unsigned char) * arguments.array[0].used); f_status_t status_file = f_file_is(path_file, F_file_type_regular_d, F_false); diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index f72364d..245b246 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -312,13 +312,13 @@ extern "C" { source->used = 0; - memcpy(source->string, main->path_sources.string, main->path_sources.used); + memcpy(source->string, main->path_sources.string, sizeof(unsigned char) * main->path_sources.used); source->used += main->path_sources.used; - memcpy(source->string, fake_default_path_sources_s.string, fake_default_path_sources_s.used); + memcpy(source->string, fake_default_path_sources_s.string, sizeof(unsigned char) * fake_default_path_sources_s.used); source->used += fake_default_path_sources_s.used; - memcpy(source->string + source->used, partial->string, partial->used); + memcpy(source->string + source->used, partial->string, sizeof(unsigned char) * partial->used); source->used += partial->used; source->string[source->used] = 0; diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index a7c4e56..d7d78a7 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -401,8 +401,8 @@ extern "C" { path_file_other.string = path_file_other_string; path_file_other_string[path_file_other.used] = 0; - memcpy(path_file_other_string, firewall_network_path_s.string, firewall_network_path_s.used); - memcpy(path_file_other_string + firewall_network_path_s.used, firewall_file_other_s.string, firewall_file_other_s.used); + memcpy(path_file_other_string, firewall_network_path_s.string, sizeof(unsigned char) * firewall_network_path_s.used); + memcpy(path_file_other_string + firewall_network_path_s.used, firewall_file_other_s.string, sizeof(unsigned char) * firewall_file_other_s.used); status = firewall_buffer_rules(main, path_file_other, F_false, &local); @@ -522,8 +522,8 @@ extern "C" { path_file_first.string = path_file_first_string; path_file_first_string[path_file_first.used] = 0; - memcpy(path_file_first_string, firewall_network_path_s.string, firewall_network_path_s.used); - memcpy(path_file_first_string + firewall_network_path_s.used, firewall_file_first_s.string, firewall_file_first_s.used); + memcpy(path_file_first_string, firewall_network_path_s.string, sizeof(unsigned char) * firewall_network_path_s.used); + memcpy(path_file_first_string + firewall_network_path_s.used, firewall_file_first_s.string, sizeof(unsigned char) * firewall_file_first_s.used); status = firewall_buffer_rules(main, path_file_first, F_false, &local); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index df1d5e0..221c046 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -171,7 +171,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (F_status_is_error(status)) break; } - memcpy(device.string, main->devices.array[local.device].string, main->devices.array[local.device].used); + memcpy(device.string, main->devices.array[local.device].string, sizeof(unsigned char) * main->devices.array[local.device].used); device.used = main->devices.array[local.device].used; } diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index e5a6b60..10be9c4 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -22,7 +22,7 @@ extern "C" { // Determine the linear order in which all of the three parameter values are to be applied. if (values_total) { - memset(values_order, 0, values_total); + memset(values_order, 0, sizeof(unsigned char) * values_total); f_array_length_t k = 0; f_array_length_t l = 0; diff --git a/level_3/fss_payload_write/c/private-write.c b/level_3/fss_payload_write/c/private-write.c index 162ac5f..61a50a6 100644 --- a/level_3/fss_payload_write/c/private-write.c +++ b/level_3/fss_payload_write/c/private-write.c @@ -311,7 +311,7 @@ extern "C" { break; } - memcpy(content.string, block.string + range.start, total); + memcpy(content.string, block.string + range.start, sizeof(unsigned char) * total); content.used += total; } @@ -386,7 +386,7 @@ extern "C" { break; } - memcpy(content.string, block.string, block.used); + memcpy(content.string, block.string, sizeof(unsigned char) * block.used); content.used += block.used; } -- 1.8.3.1