fix valgrind-noted empty array cruft.

This commit is contained in:
Eric House 2019-02-22 19:29:56 -08:00
parent 8be4bd5f51
commit 0ad1697607

View file

@ -202,13 +202,16 @@ linux_dutil_loadStream( XW_DUtilCtxt* duc, const XP_UCHAR* key,
{ {
XP_U16 len = 0; XP_U16 len = 0;
linux_dutil_loadPtr( duc, key, NULL, &len ); linux_dutil_loadPtr( duc, key, NULL, &len );
XP_U8 buf[len]; if ( 0 < len ) {
linux_dutil_loadPtr( duc, key, buf, &len ); XP_U8 buf[len];
linux_dutil_loadPtr( duc, key, buf, &len );
XP_ASSERT( buf[len-1] == '\0' );
gsize out_len; gsize out_len;
guchar* txt = g_base64_decode( (const gchar*)buf, &out_len ); guchar* txt = g_base64_decode( (const gchar*)buf, &out_len ); /* BAD */
stream_putBytes( stream, txt, out_len ); stream_putBytes( stream, txt, out_len );
g_free( txt ); g_free( txt );
}
XP_LOGF( "%s(key=%s) => len: %d", __func__, key, stream_getSize(stream) ); XP_LOGF( "%s(key=%s) => len: %d", __func__, key, stream_getSize(stream) );
} }