mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Fix calc_header_length when LEN is 0 and improve documentation.
* g10/build-packet.c (calc_header_length): Return the correct haeder size when LEN is 0. Fix documentation. -- Signed-off-by: Neal H. Walfield <neal@g10code.com> GnuPG-bug-id: 2240
This commit is contained in:
parent
c0268c449d
commit
5cdde08ea8
1 changed files with 8 additions and 4 deletions
|
@ -1215,14 +1215,18 @@ write_32(IOBUF out, u32 a)
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* calculate the length of a header
|
* calculate the length of a header.
|
||||||
|
*
|
||||||
|
* LEN is the length of the packet's body. NEW_CTB is whether we are
|
||||||
|
* using a new or old format packet.
|
||||||
|
*
|
||||||
|
* This function does not handle indeterminate lengths or partial body
|
||||||
|
* lengths. (If you pass LEN as 0, then this function assumes you
|
||||||
|
* really mean an empty body.)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
calc_header_length( u32 len, int new_ctb )
|
calc_header_length( u32 len, int new_ctb )
|
||||||
{
|
{
|
||||||
if( !len )
|
|
||||||
return 1; /* only the ctb */
|
|
||||||
|
|
||||||
if( new_ctb ) {
|
if( new_ctb ) {
|
||||||
if( len < 192 )
|
if( len < 192 )
|
||||||
return 2;
|
return 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue