From 57c1dbc21d402a591585d07bef527c6abcd07c9a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 9 Aug 2001 15:49:28 +0000 Subject: [PATCH] fixed silly allocation bug --- g10/ChangeLog | 5 ++++- g10/build-packet.c | 3 ++- g10/parse-packet.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 5325767db..05a3a42e5 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,8 @@ 2001-08-09 Werner Koch + * build-packet.c (build_sig_subpkt): Fixed calculation of + newarea->size. + * g10.c (main): New option "--preference-list" * keyedit.c (keyedit_menu): New commands "setpref" and "updpref". (menu_set_preferences): New. @@ -11,7 +14,7 @@ (keygen_add_std_prefs): Move the pref setting code into the above fnc. * build-packet.c (build_sig_subpkt): Updated the list of allowed to update subpackets. - + 2001-08-08 Werner Koch * packet.h (subpktarea_t): New. diff --git a/g10/build-packet.c b/g10/build-packet.c index 1235a451e..e39756dac 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -800,11 +800,12 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type, } else if (oldarea) { 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 );*/ } else { newarea = m_alloc (sizeof (*newarea) + n - 1); + newarea->size = n; /*log_debug ("allocating area for type %d\n", type );*/ } newarea->len = n; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index f2f35afc2..0c3ab6188 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1139,7 +1139,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen, goto leave; } 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 * packet already, but in the other case it avoids an realloc */ sig->unhashed = m_alloc (sizeof(*sig->unhashed) + n + 8 - 1 );