[gnutls-devel] GnuTLS | VLA in _gnutls_dump_vector() (#1336)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Mon Mar 14 11:30:42 CET 2022
Gisle Vanem created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1336
Compiling the `debug.c` file with `cl -c -DDEBUG ...` (with MSVC-2019), yields this error:
```c
debug.c(47): error C2057: expected constant expression
debug.c(47): error C2466: cannot allocate an array of constant size 0
debug.c(47): error C2133: 'buf_hex': unknown size
debug.c(51): warning C4034: sizeof returns 0
```
Wouldn't it be better by using `alloca()` for MSVC in this case:
```diff
--- a/lib/debug.c 2022-03-13 16:34:15
+++ b/lib/debug.c 2022-03-14 11:28:50
@@ -44,7 +44,11 @@
void
_gnutls_dump_vector(const char *prefix, const uint8_t * a, size_t a_size)
{
- char buf_hex[2 * a_size + 1];
+#ifdef _MSC_VER
+ char *buf_hex = alloca (2 * a_size + 1);
+#else
+ char *buf_hex[2 * a_size + 1];
+#endif
```
But I cannot see this functions is called anywhere. So why is it there?
I made a similar [issue](https://gitlab.com/gnutls/gnutls/-/issues/248) 4 years ago.
And I'm amazed MSVC is still not fully supported.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1336
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20220314/1b9bfcc9/attachment.html>
More information about the Gnutls-devel
mailing list