Ver código fonte

Fix potential buffer overflow problem

Matthias Vogelgesang 7 anos atrás
pai
commit
5e4b412d53
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      src/iridium-crypto.c

+ 1 - 1
src/iridium-crypto.c

@@ -86,7 +86,7 @@ iridium_crypto_unhexlify (const gchar *s, gsize length)
 {
   guint8 *result;
 
-  result = g_malloc0 (length / 2);
+  result = g_malloc0 (length / 2 + 1);
 
   for (gsize i = 0; i < length / 2; i++)
     sscanf (&s[i * 2], "%2hhx", &result[i]);