[tests] fix compiler warnings when used with latest GCC

Compiled with GCC version 15.2.0 found in Ubuntu 25.10.

warning: initializer-string for array of 'unsigned char' truncates NUL
terminator but destination lacks 'nonstring' attribute (17 chars into 16
available) [-Wunterminated-string-initialization]
This commit is contained in:
Bostjan Meglic 2025-11-04 11:57:18 +01:00 committed by Sukchan Lee
parent 0f1cb83373
commit a9a16ae982
5 changed files with 77 additions and 60 deletions

View file

@ -67,7 +67,8 @@ ogs_pkbuf_t *testemm_build_attach_request(
*ue_additional_security_capability =
&attach_request->ue_additional_security_capability;
uint8_t classmark_3[11] = "\x60\x14\x04\xef\x65\x23\x3b\x88\x78\xd2\x90";
uint8_t classmark_3[11] = {
0x60, 0x14, 0x04, 0xef, 0x65, 0x23, 0x3b, 0x88, 0x78, 0xd2, 0x90 };
ogs_assert(test_ue);
ogs_assert(esmbuf);
@ -591,7 +592,7 @@ ogs_pkbuf_t *testemm_build_tau_request(
*ue_additional_security_capability =
&tau_request->ue_additional_security_capability;
uint8_t classmark_3[11] = "\x60\x14\x04\xef\x65\x23\x3b\x88\x78\xd2\x90";
uint8_t classmark_3[11] = { 0x60, 0x14, 0x04, 0xef, 0x65, 0x23, 0x3b, 0x88, 0x78, 0xd2, 0x90 };
ogs_assert(test_ue);

View file

@ -37,15 +37,15 @@ ogs_pkbuf_t *testesm_build_pdn_connectivity_request(
ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options =
&pdn_connectivity_request->extended_protocol_configuration_options;
#if 0
uint8_t ue_pco[29] =
"\x80\x80\x21\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00"
"\x83\x06\x00\x00\x00\x00\x00\x03\x00\x00\x0a\x00\x00\x0d\x00";
uint8_t ue_pco[7] = "\x80\x00\x0a\x00\x00\x0d\x00";
uint8_t ue_pco[29] = {
0x80, 0x80, 0x21, 0x10, 0x01, 0x01, 0x00, 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00,
0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0d, 0x00 };
uint8_t ue_pco[7] = { 0x80, 0x00, 0x0a, 0x00, 0x00, 0x0d, 0x00 };
#else
uint8_t ue_pco[35] =
"\x80\x80\x21\x10\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00"
"\x83\x06\x00\x00\x00\x00\x00\x0c\x00\x00\x0d\x00\x00\x02\x00\x00"
"\x0a\x00\x00\x10\x00";
uint8_t ue_pco[35] = {
0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00,
0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x02, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x10, 0x00 };
#endif
test_ue_t *test_ue = NULL;
@ -170,27 +170,27 @@ ogs_pkbuf_t *testesm_build_esm_information_response(test_sess_t *sess)
&esm_information_response->extended_protocol_configuration_options;
#if 0
uint8_t ue_pco[29] =
"\x80\x80\x21\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00"
"\x83\x06\x00\x00\x00\x00\x00\x03\x00\x00\x0a\x00\x00\x0d\x00";
uint8_t ue_pco[94] =
"\x80\xc2\x23"
"\x23\x01\x01\x00\x23\x10\xec\xa3\x90\x00\x3e\xdb\xf9\x17\xbe\xcf"
"\xa8\x14\x8a\xcd\xde\x56\x55\x4d\x54\x53\x5f\x43\x48\x41\x50\x5f"
"\x53\x52\x56\x52\xc2\x23\x15\x02\x01\x00\x15\x10\xb6\xfa\xad\xc5"
"\x6a\x43\x6b\x2f\x0f\x9f\x82\x35\x6e\x07\xd9\xd9\x80\x21\x1c\x01"
"\x00\x00\x1c\x81\x06\x00\x00\x00\x00\x82\x06\x00\x00\x00\x00\x83"
"\x06\x00\x00\x00\x00\x84\x06\x00\x00\x00\x00";
uint8_t ue_pco[35] =
"\x80\x80\x21\x10\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00"
"\x83\x06\x00\x00\x00\x00\x00\x0c\x00\x00\x0d\x00\x00\x02\x00\x00"
"\x0a\x00\x00\x10\x00";
uint8_t ue_pco[29] = {
0x80, 0x80, 0x21, 0x10, 0x01, 0x01, 0x00, 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00,
0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0d, 0x00 };
uint8_t ue_pco[94] = {
0x80, 0xc2, 0x23,
0x23, 0x01, 0x01, 0x00, 0x23, 0x10, 0xec, 0xa3, 0x90, 0x00, 0x3e, 0xdb, 0xf9, 0x17, 0xbe, 0xcf,
0xa8, 0x14, 0x8a, 0xcd, 0xde, 0x56, 0x55, 0x4d, 0x54, 0x53, 0x5f, 0x43, 0x48, 0x41, 0x50, 0x5f,
0x53, 0x52, 0x56, 0x52, 0xc2, 0x23, 0x15, 0x02, 0x01, 0x00, 0x15, 0x10, 0xb6, 0xfa, 0xad, 0xc5,
0x6a, 0x43, 0x6b, 0x2f, 0x0f, 0x9f, 0x82, 0x35, 0x6e, 0x07, 0xd9, 0xd9, 0x80, 0x21, 0x1c, 0x01,
0x00, 0x00, 0x1c, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x82, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83,
0x06, 0x00, 0x00, 0x00, 0x00, 0x84, 0x06, 0x00, 0x00, 0x00, 0x00 };
uint8_t ue_pco[35] = {
0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00,
0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x02, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x10, 0x00 };
#endif
uint8_t ue_pco[47] =
"\x80\x80\x21\x0a\x01\x0a"
"\x00\x0a\x81\x06\x00\x00\x00\x00\x80\x21\x0a\x01\x0b\x00\x0a\x83"
"\x06\x00\x00\x00\x00\xc0\x23\x11\x01\x0c\x00\x11\x03\x72\x69\x6d"
"\x08\x70\x61\x73\x73\x77\x6f\x72\x64";
uint8_t ue_pco[47] = {
0x80, 0x80, 0x21, 0x0a, 0x01, 0x0a,
0x00, 0x0a, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0a, 0x01, 0x0b, 0x00, 0x0a, 0x83,
0x06, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x11, 0x01, 0x0c, 0x00, 0x11, 0x03, 0x72, 0x69, 0x6d,
0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64 };
test_ue_t *test_ue = NULL;
ogs_pkbuf_t *pkbuf = NULL;
@ -425,7 +425,7 @@ ogs_pkbuf_t *testesm_build_bearer_resource_allocation_request(
ogs_nas_eps_quality_of_service_t *required_traffic_flow_qos =
&bearer_resource_allocation_request->required_traffic_flow_qos;
uint8_t tft[4] = "\x21\x20\x01\x00";
uint8_t tft[4] = { 0x21, 0x20, 0x01, 0x00 };
test_ue_t *test_ue = NULL;
test_sess_t *sess = NULL;

View file

@ -39,19 +39,19 @@ ogs_pkbuf_t *testgsm_build_pdu_session_establishment_request(
* Response (2)
*/
#if 0
uint8_t ue_pco[94] =
"\x80\xc2\x23\x16\x01\x00\x00\x16\x10\xa1\x53\x8b\x8b"
"\xa1\x53\x8b\x8b\xa1\x53\x8b\x8b\xa1\x53\x8b\x8b\x2a\xc2\x23\x16"
"\x02\x00\x00\x16\x10\x52\xfb\x1e\xd0\x6e\x58\xd6\x5c\xb6\x3f\x54"
"\x45\x9c\x94\x84\xaa\x2a\x80\x21\x10\x01\x00\x00\x10\x81\x06\x00"
"\x00\x00\x00\x83\x06\x00\x00\x00\x00\x00\x0d\x00\x00\x03\x00\x00"
"\x0a\x00\x00\x05\x00\x00\x10\x00\x00\x11\x00\x00\x23\x00\x00\x24"
"\x00";
uint8_t ue_pco[94] = {
0x80, 0xc2, 0x23, 0x16, 0x01, 0x00, 0x00, 0x16, 0x10, 0xa1, 0x53, 0x8b, 0x8b,
0xa1, 0x53, 0x8b, 0x8b, 0xa1, 0x53, 0x8b, 0x8b, 0xa1, 0x53, 0x8b, 0x8b, 0x2a, 0xc2, 0x23, 0x16,
0x02, 0x00, 0x00, 0x16, 0x10, 0x52, 0xfb, 0x1e, 0xd0, 0x6e, 0x58, 0xd6, 0x5c, 0xb6, 0x3f, 0x54,
0x45, 0x9c, 0x94, 0x84, 0xaa, 0x2a, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, 0x10, 0x81, 0x06, 0x00,
0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x10, 0x00, 0x00, 0x11, 0x00, 0x00, 0x23, 0x00, 0x00, 0x24,
0x00 };
#endif
uint8_t ue_pco[35] =
"\x80\x80\x21\x10\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00"
"\x83\x06\x00\x00\x00\x00\x00\x0c\x00\x00\x0d\x00\x00\x02\x00\x00"
"\x0a\x00\x00\x10\x00";
uint8_t ue_pco[35] = {
0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00,
0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x02, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x10, 0x00 };
test_ue_t *test_ue = NULL;
ogs_pkbuf_t *pkbuf = NULL;

View file

@ -26,12 +26,18 @@ static void conv_test2(abts_case *tc, void *data)
#define OP "5F1D289C 5D354D0A 140C2548 F5F3E3BA"
#define OPc "E8ED2 89D EBA9 52E4 283B 54E8 8E61 83CA"
#define AMF "8000"
uint8_t k[16] = "\x46\x5B\x5C\xE8\xB1\x99\xB4\x9F\xAA\x5F\x0A\x2E\xE2\x38\xA6\xBC";
uint8_t op[16] = "\x5F\x1D\x28\x9C\x5D\x35\x4D\x0A\x14\x0C\x25\x48\xF5\xF3\xE3\xBA";
uint8_t opc[16] = "\xE8\xED\x28\x9D\xEB\xA9\x52\xE4\x28\x3B\x54\xE8\x8E\x61\x83\xCA";
uint8_t k[16] = {
0x46, 0x5B, 0x5C, 0xE8, 0xB1, 0x99, 0xB4, 0x9F,
0xAA, 0x5F, 0x0A, 0x2E, 0xE2, 0x38, 0xA6, 0xBC };
uint8_t op[16] = {
0x5F, 0x1D, 0x28, 0x9C, 0x5D, 0x35, 0x4D, 0x0A,
0x14, 0x0C, 0x25, 0x48, 0xF5, 0xF3, 0xE3, 0xBA };
uint8_t opc[16] = {
0xE8, 0xED, 0x28, 0x9D, 0xEB, 0xA9, 0x52, 0xE4,
0x28, 0x3B, 0x54, 0xE8, 0x8E, 0x61, 0x83, 0xCA };
uint8_t amf[2] = { 0x80, 0x00 };
#define LOWER " 12abcdE F"
uint8_t lower[4] = "\x12\xab\xcd\xef";
uint8_t lower[4] = { 0x12, 0xab, 0xcd, 0xef };
char buffer[16];
@ -53,11 +59,17 @@ static void conv_test2(abts_case *tc, void *data)
static void conv_test3(abts_case *tc, void *data)
{
uint8_t k[16] = "\x46\x5B\x5C\xE8\xB1\x99\xB4\x9F\xAA\x5F\x0A\x2E\xE2\x38\xA6\xBC";
uint8_t op[16] = "\x5F\x1D\x28\x9C\x5D\x35\x4D\x0A\x14\x0C\x25\x48\xF5\xF3\xE3\xBA";
uint8_t opc[16] = "\xE8\xED\x28\x9D\xEB\xA9\x52\xE4\x28\x3B\x54\xE8\x8E\x61\x83\xCA";
uint8_t k[16] = {
0x46, 0x5B, 0x5C, 0xE8, 0xB1, 0x99, 0xB4, 0x9F,
0xAA, 0x5F, 0x0A, 0x2E, 0xE2, 0x38, 0xA6, 0xBC };
uint8_t op[16] = {
0x5F, 0x1D, 0x28, 0x9C, 0x5D, 0x35, 0x4D, 0x0A,
0x14, 0x0C, 0x25, 0x48, 0xF5, 0xF3, 0xE3, 0xBA };
uint8_t opc[16] = {
0xE8, 0xED, 0x28, 0x9D, 0xEB, 0xA9, 0x52, 0xE4,
0x28, 0x3B, 0x54, 0xE8, 0x8E, 0x61, 0x83, 0xCA };
uint8_t amf[2] = { 0x80, 0x00 };
uint8_t lower[4] = "\x12\xab\xcd\xef";
uint8_t lower[4] = { 0x12, 0xab, 0xcd, 0xef };
uint8_t buffer[128];
ABTS_TRUE(tc, strcmp("465b5ce8b199b49faa5f0a2ee238a6bc",
@ -75,7 +87,7 @@ static void conv_test3(abts_case *tc, void *data)
static void conv_test4(abts_case *tc, void *data)
{
#define MAX_SIZE 8
uint8_t tmp[MAX_SIZE] = "\x01\x23\x45\x67\x89\xab\xcd\xef";
uint8_t tmp[MAX_SIZE] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
uint8_t buf[MAX_SIZE];
uint64_t num;
@ -137,11 +149,11 @@ static void conv_test6(abts_case *tc, void *data)
static void conv_test7(abts_case *tc, void *data)
{
char out[32];
uint8_t buf1[6] = "\x94\x71\x52\x76\x00\x41";
uint8_t buf1[6] = { 0x94, 0x71, 0x52, 0x76, 0x00, 0x41 };
int buf1_len = 6;
uint8_t buf2[8] = "\x53\x61\x20\x00\x91\x78\x84\x00";
uint8_t buf2[8] = { 0x53, 0x61, 0x20, 0x00, 0x91, 0x78, 0x84, 0x00 };
int buf2_len = 8;
uint8_t buf3[8] = "\x00\x01\x01\x21\x43\x65\x18\xf9";
uint8_t buf3[8] = { 0x00, 0x01, 0x01, 0x21, 0x43, 0x65, 0x18, 0xf9 };
int buf3_len = 8;
ogs_buffer_to_bcd(buf1, buf1_len, out);

View file

@ -34,12 +34,16 @@ static void aes_test1(abts_case *tc, void *data)
{
const int key_bits = 128;
unsigned int rk[OGS_AES_RKLENGTH(128)];
unsigned char key[16] =
"\x00\x01\x02\x03\x05\x06\x07\x08\x0A\x0B\x0C\x0D\x0F\x10\x11\x12";
unsigned char pt[16] = "\x50\x68\x12\xA4\x5F\x08\xC8\x89\xB9\x7F\x59\x80\x03\x8B\x83\x59";
unsigned char key[16] = {
0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08,
0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x10, 0x11, 0x12 };
unsigned char pt[16] = {
0x50, 0x68, 0x12, 0xA4, 0x5F, 0x08, 0xC8, 0x89,
0xB9, 0x7F, 0x59, 0x80, 0x03, 0x8B, 0x83, 0x59 };
unsigned char ct[16];
unsigned char expected[16] =
"\xD8\xF5\x32\x53\x82\x89\xEF\x7D\x06\xB5\x06\xA4\xFD\x5B\xE9\xC9";
unsigned char expected[16] = {
0xD8, 0xF5, 0x32, 0x53, 0x82, 0x89, 0xEF, 0x7D,
0x06, 0xB5, 0x06, 0xA4, 0xFD, 0x5B, 0xE9, 0xC9 };
int nrounds;
int rc;