diff --git a/ChangeLog b/ChangeLog index c4a3f8ecf..8aa77ce81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-16 Matthias Clasen + + * 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 * glib/gscanner.[hc]: reverted premature commit which broke @@ -8,6 +13,11 @@ Fri Mar 16 11:24:51 2007 Tim Janik * glib/gkeyfile.c: Convert to GSlice and check for redundant clears. (#418637) +2007-03-15 Matthias Clasen + + * glib/gscanner.[hc]: Revert recent changes that break + existing users of GScanner. + 2007-03-15 Matthias Clasen * glib/gscanner.c (g_scanner_get_token_ll): Fix a typo diff --git a/glib/gbase64.c b/glib/gbase64.c index c6902b2e2..f45df1e6c 100644 --- a/glib/gbase64.c +++ b/glib/gbase64.c @@ -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; }