Examples of errors detected by the V638 diagnostic

V638. A terminal null is present inside a string. The '\0xNN' characters were encountered. Probably meant: '\xNN'.


Oracle VM Virtual Box

V638 A terminal null is present inside a string. The '\0x01' characters were encountered. Probably meant: '\x01'. devsmc.cpp 129


static struct AppleSMCData data[] =
{
  {6, "REV ", "\0x01\0x13\0x0f\0x00\0x00\0x03"},  // <=
  {32,"OSK0", osk },
  {32,"OSK1", osk+32 },
  {1, "NATJ",  "\0" },
  {1, "MSSP",  "\0" },
  {1, "MSSD",  "\0x3" },                          // <=
  {1, "NTOK",  "\0"},
  {0, NULL,    NULL }
};

Most likely this is what should be written here: {6, "REV ", "\x01\x13\x0f\x00\x00\x03"} .... {1, "MSSD", "\x3" } ....


Linux Kernel

V638 A terminal null is present inside a string. The '\0x00' characters were encountered. Probably meant: '\x00'. message.c 4883


static void sig_ind(PLCI *plci)
{
  ....
  byte SS_Ind[] =
    "\x05\x02\x00\x02\x00\x00"; /* Hold_Ind struct*/
  byte CF_Ind[] =
    "\x09\x02\x00\x06\x00\x00\x00\x00\x00\x00";
  byte Interr_Err_Ind[] =
    "\x0a\x02\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  byte CONF_Ind[] =
    "\x09\x16\x00\x06\x00\x00\0x00\0x00\0x00\0x00";
                              ^^^^^^^^^^^^^^^^^^^
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;