Dynamic on-stack arrays are not supported in Visual Studio.
This has the downside of introducing an extra memory allocation into
libstun, but it’s on a debug path so should be harmless.
{
size_t i;
size_t prefix_len = strlen (prefix);
- char bytes[prefix_len + 2 + (len * 2) + 1];
+ char *bytes;
if (!debug_enabled)
return;
+ bytes = malloc (prefix_len + 2 + (len * 2) + 1);
bytes[0] = 0;
strcpy (bytes, prefix);
strcpy (bytes + prefix_len, "0x");
sprintf (bytes + prefix_len + 2 + (i * 2), "%02x", ((const unsigned char *)data)[i]);
stun_debug ("%s", bytes);
+ free (bytes);
}