@@ -525,6 +525,10 @@ ZTEST(net_content_json, test_get_s64)
525
525
TEST_PAYLOAD (TEST_RES_S64 , "v" , "9223372036854775807" ),
526
526
TEST_PAYLOAD (TEST_RES_S64 , "v" , "-9223372036854775808" ),
527
527
};
528
+ char * const payload_overflow [] = {
529
+ TEST_PAYLOAD (TEST_RES_S64 , "v" , "9223372036854775808" ),
530
+ TEST_PAYLOAD (TEST_RES_S64 , "v" , "-9223372036854775809" ),
531
+ };
528
532
int64_t expected_value [] = { 0 , INT64_MAX , INT64_MIN };
529
533
530
534
test_msg .path .res_id = TEST_RES_S64 ;
@@ -536,6 +540,13 @@ ZTEST(net_content_json, test_get_s64)
536
540
zassert_true (ret >= 0 , "Error reported" );
537
541
zassert_equal (test_s64 , expected_value [i ], "Invalid value parsed" );
538
542
}
543
+
544
+ for (i = 0 ; i < ARRAY_SIZE (payload_overflow ); i ++ ) {
545
+ test_payload_set (payload_overflow [i ]);
546
+
547
+ ret = do_write_op_json (& test_msg );
548
+ zassert_equal (ret , - EINVAL , "Error expected on too large value" );
549
+ }
539
550
}
540
551
541
552
ZTEST (net_content_json_nodata , test_get_s64_nodata )
0 commit comments