bugGNU GRUB - Bugs: bug #62354, pgp fails to calculate the new...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62354: pgp fails to calculate the new format packet length of 192 to 8383 octets

Submitter:  Xiaoxin Yang <xiaoxin>
Submitted:  Fri 22 Apr 2022 09:12:06 PM UTC
   
 
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  Git master
Release:  Reproducibility:  Every Time
Planned Release:  None

Fri 22 Apr 2022 09:12:06 PM UTC, original submission:  



In rfc4880:

section 4.2.2.2.  Two-Octet Lengths

   A two-octet Body Length header encodes a length of 192 to 8383
   octets.  It is recognized because its first octet is in the range 192
   to 223.  The body length is equal to:

       bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192

Code in grub-core/commands/pgp.c doesn't add 192:
  92       if (l < 224)
  93         {
  94           *len = (l - 192) << GRUB_CHAR_BIT;
  95           if (grub_file_read (sig, &l, sizeof (l)) != 1)
  96             return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
  97           *len |= l;
  98           return 0;
  99         }

A minor patch could fix it:

diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c
index c6766f044..baabcae35 100644
--- a/grub-core/commands/pgp.c
+++ b/grub-core/commands/pgp.c
@@ -95,6 +95,7 @@ read_packet_header (grub_file_t sig, grub_uint8_t *out_type, grub_size_t *len)
          if (grub_file_read (sig, &l, sizeof (l)) != 1)
            return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
          *len |= l;
+         *len += 192;
          return 0;
        }
       if (l == 255)

Xiaoxin Yang <xiaoxin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by xiaoxin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.12