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=/trunk/; revision=5417
This commit is contained in:
Matthias Clasen 2007-03-16 19:50:14 +00:00 committed by Matthias Clasen
parent 44d5b8af2a
commit c182fecfa1
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2007-03-16 Matthias Clasen <mclasen@redhat.com>
* glib/gbase64.c (g_base64_decode): Warn if the input
is too short. (#418862, Halton Huo)
Fri Mar 16 11:24:51 2007 Tim Janik <timj@imendio.com>
* glib/gscanner.[hc]: reverted premature commit which broke
@ -8,6 +13,11 @@ Fri Mar 16 11:24:51 2007 Tim Janik <timj@imendio.com>
* glib/gkeyfile.c: Convert to GSlice and check for redundant
clears. (#418637)
2007-03-15 Matthias Clasen <mclasen@redhat.com>
* glib/gscanner.[hc]: Revert recent changes that break
existing users of GScanner.
2007-03-15 Matthias Clasen <mclasen@redhat.com>
* glib/gscanner.c (g_scanner_get_token_ll): Fix a typo

View File

@ -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;
}