mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-04 13:06:54 +02:00
ghostutils: Limit punycode decoding output length
It uses a `GArray` to build up the output, and the size of that is limited to a `guint`, so add an assertion to make sure the code never requests anything bigger. Fixes a `-Wshorten-64-to-32` warning. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3527
This commit is contained in:
parent
e35aa61a55
commit
a6c36498ed
@ -35,6 +35,7 @@
|
||||
#include "gmessages.h"
|
||||
#include "gstring.h"
|
||||
#include "gstrfuncs.h"
|
||||
#include "gtestutils.h"
|
||||
#include "glibintl.h"
|
||||
|
||||
#ifdef G_PLATFORM_WIN32
|
||||
@ -587,8 +588,10 @@ punycode_decode (const gchar *input,
|
||||
split--;
|
||||
if (split > input)
|
||||
{
|
||||
g_assert ((guint) (split - input) <= G_MAXUINT);
|
||||
|
||||
output_chars = g_array_sized_new (FALSE, FALSE, sizeof (gunichar),
|
||||
split - input);
|
||||
(guint) (split - input));
|
||||
input_length -= (split - input) + 1;
|
||||
while (input < split)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user