1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-23 15:07:03 +01:00

fixed silly allocation bug

This commit is contained in:
Werner Koch 2001-08-09 15:49:28 +00:00
parent a255ea76ae
commit 57c1dbc21d
3 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,8 @@
2001-08-09 Werner Koch <wk@gnupg.org> 2001-08-09 Werner Koch <wk@gnupg.org>
* build-packet.c (build_sig_subpkt): Fixed calculation of
newarea->size.
* g10.c (main): New option "--preference-list" * g10.c (main): New option "--preference-list"
* keyedit.c (keyedit_menu): New commands "setpref" and "updpref". * keyedit.c (keyedit_menu): New commands "setpref" and "updpref".
(menu_set_preferences): New. (menu_set_preferences): New.

View File

@ -800,11 +800,12 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type,
} }
else if (oldarea) { else if (oldarea) {
newarea = m_realloc (oldarea, sizeof (*newarea) + n - 1); newarea = m_realloc (oldarea, sizeof (*newarea) + n - 1);
newarea->size = sizeof (*newarea) + n - 1; newarea->size = n;
/*log_debug ("reallocating area for type %d\n", type );*/ /*log_debug ("reallocating area for type %d\n", type );*/
} }
else { else {
newarea = m_alloc (sizeof (*newarea) + n - 1); newarea = m_alloc (sizeof (*newarea) + n - 1);
newarea->size = n;
/*log_debug ("allocating area for type %d\n", type );*/ /*log_debug ("allocating area for type %d\n", type );*/
} }
newarea->len = n; newarea->len = n;

View File

@ -1139,7 +1139,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
goto leave; goto leave;
} }
if( n ) { if( n ) {
/* we add 6 extra bytes so that we have space for the signature /* we add 8 extra bytes so that we have space for the signature
* status cache. Well we are wastin this if there is a cache * status cache. Well we are wastin this if there is a cache
* packet already, but in the other case it avoids an realloc */ * packet already, but in the other case it avoids an realloc */
sig->unhashed = m_alloc (sizeof(*sig->unhashed) + n + 8 - 1 ); sig->unhashed = m_alloc (sizeof(*sig->unhashed) + n + 8 - 1 );