mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-04 20:59:21 +02:00
Warn if the input is too short. (#418862, Halton Huo)
2007-03-16 Matthias Clasen <mclasen@redhat.com> * glib/gbase64.c (g_base64_decode): Warn if the input is too short. (#418862, Halton Huo) svn path=/branches/glib-2-12/; revision=5418
This commit is contained in:
committed by
Matthias Clasen
parent
a978934c2a
commit
d62b406c38
@@ -1,3 +1,10 @@
|
||||
2007-03-16 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Merge from trunk:
|
||||
|
||||
* glib/gbase64.c (g_base64_decode): Warn if the input
|
||||
is too short. (#418862, Halton Huo)
|
||||
|
||||
2007-03-08 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.12.11 ===
|
||||
|
@@ -358,16 +358,19 @@ g_base64_decode (const gchar *text,
|
||||
gsize *out_len)
|
||||
{
|
||||
guchar *ret;
|
||||
gint inlen, state = 0;
|
||||
gint input_length, state = 0;
|
||||
guint save = 0;
|
||||
|
||||
g_return_val_if_fail (text != NULL, NULL);
|
||||
g_return_val_if_fail (out_len != NULL, NULL);
|
||||
|
||||
inlen = strlen (text);
|
||||
ret = g_malloc0 (inlen * 3 / 4);
|
||||
input_length = strlen (text);
|
||||
|
||||
g_return_val_if_fail (input_length > 1, NULL);
|
||||
|
||||
ret = g_malloc0 (input_length * 3 / 4);
|
||||
|
||||
*out_len = g_base64_decode_step (text, inlen, ret, &state, &save);
|
||||
*out_len = g_base64_decode_step (text, input_length, ret, &state, &save);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user