From 9d73e9b7cc82bb24a5ab9f1bd5395ab9a4f4408d Mon Sep 17 00:00:00 2001 From: orbisai0security Date: Sun, 17 May 2026 04:37:52 +0000 Subject: [PATCH] fix: V-001 security vulnerability Automated security fix generated by Orbis Security AI --- .../flatcc/include/flatcc/portable/pstdint.h | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/thirdparty/flatcc/include/flatcc/portable/pstdint.h b/thirdparty/flatcc/include/flatcc/portable/pstdint.h index 3294baac2..f12e1caa1 100644 --- a/thirdparty/flatcc/include/flatcc/portable/pstdint.h +++ b/thirdparty/flatcc/include/flatcc/portable/pstdint.h @@ -830,42 +830,42 @@ int main () { uintmax_t umax = UINTMAX_C(0); char str0[256], str1[256]; - sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); + snprintf (str0, sizeof(str0), "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH)); - sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); + snprintf (str0, sizeof(str0), "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH)); #ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); + snprintf (str1, sizeof(str1), "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1))); - sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); + snprintf (str1, sizeof(str1), "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1))); #endif - sprintf (str0, "%d %x\n", 0, ~0); + snprintf (str0, sizeof(str0), "%d %x\n", 0, ~0); - sprintf (str1, "%d %x\n", i8, ~0); + snprintf (str1, sizeof(str1), "%d %x\n", i8, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1)); - sprintf (str1, "%u %x\n", u8, ~0); + snprintf (str1, sizeof(str1), "%u %x\n", u8, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1)); - sprintf (str1, "%d %x\n", i16, ~0); + snprintf (str1, sizeof(str1), "%d %x\n", i16, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1)); - sprintf (str1, "%u %x\n", u16, ~0); + snprintf (str1, sizeof(str1), "%u %x\n", u16, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1)); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); + snprintf (str1, sizeof(str1), "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1)); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); + snprintf (str1, sizeof(str1), "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1)); #ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); + snprintf (str1, sizeof(str1), "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1)); #endif - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); + snprintf (str1, sizeof(str1), "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1)); - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); + snprintf (str1, sizeof(str1), "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1)); TESTUMAX(8);