aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-06-28g10: Fix --list-packets.NIIBE Yutaka1-1/+1
* g10/gpg.c (main): Call set_packet_list_mode after assignment of opt.list_packets. * g10/mainproc.c (do_proc_packets): Don't stop processing with --list-packets as the comment says. * g10/options.h (list_packets): Fix the comment. * g10/parse-packet.c: Fix the condition for opt.list_packets. -- (backport of master commit 52f65281f9743c42a48bf5a3354c9ab0ecdb681a) Debian-bug-id: 828109 Signed-off-by: NIIBE Yutaka <[email protected]>
2015-10-01gpg: Silence a compiler warning.Werner Koch1-4/+4
* g10/parse-packet.c (enum_sig_subpkt): Replace hack. -- GCC 5 failure reported by Kevin Locke <[email protected]> (backport from master commit 6a0c3fa19cfcdd590b96691e8a8ffb48fb5e0ec4)
2015-04-05gpg: Fix DoS while parsing mangled secret key packets.Werner Koch1-7/+43
* g10/parse-packet.c (parse_key): Check PKTLEN before calling mpi_read et al. -- Due to the missing length checks PKTLEN may turn negative. Because PKTLEN is an unsigned int the malloc in read_rest would try to malloc a too large number and terminate the process with "error reading rest of packet: Cannot allocate memory". Reported-by: Hanno Böck. Signed-off-by: Werner Koch <[email protected]> (backported from 2.1 commit d901efcebaefaf6eae4a9b9aa8f0c2c055d3518a)
2015-02-12Use inline functions to convert buffer data to scalars.Werner Koch1-20/+21
* include/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- This fixes sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. (back ported from commit 2183683bd633818dd031b090b5530951de76f392) Signed-off-by: Werner Koch <[email protected]>
2015-02-12gpg: Fix a NULL-deref due to empty ring trust packets.Werner Koch1-3/+5
* g10/parse-packet.c (parse_trust): Always allocate a packet. -- Reported-by: Hanno Böck <[email protected]> Signed-off-by: Werner Koch <[email protected]> (back ported from commit 39978487863066e59bb657f5fe4e8baab510da7e)
2015-02-12gpg: Limit the size of key packets to a sensible value.Werner Koch1-3/+18
* g10/parse-packet.c (MAX_KEY_PACKET_LENGTH): New. (MAX_UID_PACKET_LENGTH): New. (MAX_COMMENT_PACKET_LENGTH): New. (MAX_ATTR_PACKET_LENGTH): New. (parse_key): Limit the size of a key packet to 256k. (parse_user_id): Use macro for the packet size limit. (parse_attribute): Ditto. (parse_comment): Ditto. -- Without that it is possible to force gpg to allocate large amounts of memory by using a bad encoded MPI. This would be an too easy DoS. Another way to mitigate would be to change the MPI read function to allocate memory dynamically while reading the MPI. However, that complicates and possibly slows down the code. A too large key packet is in any case a sign for broken data and thus gpg should not use it. Reported-by: Hanno Böck GnuPG-bug-id: 1823 Signed-off-by: Werner Koch <[email protected]> (back ported from commit 382ba4b137b42d5f25a7e256bb7c053ee5ac7b64)
2015-01-13gpg: Fix possible read of unallocated memoryWerner Koch1-4/+7
* g10/parse-packet.c (can_handle_critical): Check content length before calling can_handle_critical_notation. -- The problem was found by Jan Bee and gniibe proposed the used fix. Thanks. This bug can't be exploited: Only if the announced length of the notation is 21 or 32 a memcmp against fixed strings using that length would be done. The compared data is followed by the actual signature and thus it is highly likely that not even read of unallocated memory will happen. Nevertheless such a bug needs to be fixed. Signed-off-by: Werner Koch <[email protected]>
2014-11-24gpg: Fix use of uninit.value in listing sig subpkts.Werner Koch1-1/+5
* g10/parse-packet.c (dump_sig_subpkt): Print regex subpacket sanitized. -- We may not use "%s" to print an arbitrary buffer. At least "%.*s" should have been used. However, it is in general preferable to escape control characters while printf user data. Reported-by: Hanno Böck Signed-off-by: Werner Koch <[email protected]> (backported from commit 596ae9f5433ca3b0e01f7acbe06fd2e424c42ae8)
2014-11-24gpg: Fix off-by-one read in the attribute subpacket parser.Werner Koch1-0/+8
* g10/parse-packet.c (parse_attribute_subpkts): Check that the attribute packet is large enough for the subpacket type. -- Reported-by: Hanno Böck Signed-off-by: Werner Koch <[email protected]> (backported from commit 0988764397f99db4efef1eabcdb8072d6159af76)
2014-07-21gpg: Cap size of attribute packets at 16MB.Werner Koch1-1/+12
* g10/parse-packet.c (parse_attribute): Avoid xmalloc failure and cap size of packet. -- Tavis Ormandy reported a fatal error for attribute packets with a zero length payload. This is due to a check in Libgcrypt's xmalloc which rejects a malloc(0) instead of silently allocating 1 byte. The fix is obvious. In addition we cap the size of attribute packets similar to what we do with user id packets. OpenPGP keys are not the proper way to store movies. Resolved conflicts: g10/parse-packet.c - indentation. Use plain fprintf.
2014-06-02gpg: Graceful skip reading of corrupt MPIs.Werner Koch1-5/+17
* g10/parse-packet.c (mpi_read): Change error message on overflow. -- This gets gpg 2.x in sync to what gpg 1.4 does. No need to die for a broken MPI. GnuPG-bug-id: 1593
2011-07-22Print the decoded iteration count with --list-packets.Werner Koch1-20/+22
Fixes bug#1355.
2010-06-18Backport bug fix. Fixes bug#1240. Werner Koch1-2/+10
2009-06-24Fixed a bunch of little bugs as reported by Fabian Keil.Werner Koch1-1/+1
Still one problem left; marked with a gcc #warning.
2009-06-17Preparing for 2.0.12.gnupg-2.0.12Werner Koch1-2/+2
2009-05-26Fix a signal cleanup problem.Werner Koch1-3/+13
Fix zero length MPI reading.
2009-05-13Print keyid in gpg --list-packets.Werner Koch1-0/+10
Add some not yet code to app-nks.c Changed batch mode expiration time computation
2008-10-20Marked all unused args on non-W32 platforms.Werner Koch1-36/+51
2008-09-25Fix bug #931Werner Koch1-16/+26
2008-04-18Adjust for the changed Camellia draft.Werner Koch1-10/+4
W32 gettext changes. Comment and typo fixes.
2008-03-25Fix bug 894.Werner Koch1-1/+2
Change default keyserver. Allow key protection with Camellia.
2007-12-12Support DSA2.Werner Koch1-2/+4
Support Camellia for testing. More audit stuff.
2007-07-04Changed to GPLv3.Werner Koch1-4/+2
Removed intl/.
2007-04-06* parse-packet.c (parse_marker): New. Enforce that the markerDavid Shaw1-22/+58
contains 'P', 'G', 'P', and nothing but. (parse): Call it here. (skip_packet): No longer need to handle marker packets here.
2007-03-10From STABLE-BRANCH-1-4David Shaw1-1/+1
* parse-packet.c (parse_signature): It's hex. * getkey.c (merge_selfsigs_subkey): Avoid listing the contents of a backsig when list mode is on. Noted by Timo Schulz.
2007-02-04Fix for Debian bug 402592Werner Koch1-3/+13
2007-01-15 * parse-packet.c (read_protected_v3_mpi): Make sure to stopWerner Koch1-2/+2
reading even for corrupted packets. * keygen.c (generate_user_id): Need to allocate one byte more. Reported by Felix von Leitner.
2006-11-10Fixed that nasty 64 bit but.Werner Koch1-10/+10
2006-10-13* parse-packet.c (parse_symkeyenc): Show the unpacked as well as theDavid Shaw1-1/+3
packed s2k iteration count. * main.h, options.h, gpg.c (encode_s2k_iterations, main), passphrase.c (hash_passphrase): Add --s2k-count option to specify the number of s2k hash iterations.
2006-10-02Fix for bug 537Werner Koch1-1/+4
2006-07-27Preparing a new releasegnupg-1.9.22Werner Koch1-0/+14
2006-07-26Fixed memory allocation bug and typos.Werner Koch1-3/+17
2006-06-30A couple of fixes. gpg2's key generation does now work.Werner Koch1-9/+13
2006-06-27Ported patches from 1.4.x Werner Koch1-7/+31
2006-06-09* parse-packet.c (parse_user_id): Cap the user ID size at 2048 bytes. David Shaw1-0/+14
This prevents a memory allocation attack with a very large user ID. A very large packet length could even cause the allocation (a u32) to wrap around to a small number. Noted by Evgeny Legerov on full-disclosure.
2006-05-23* parse-packet.c (dump_sig_subpkt, parse_signature), build-packet.cDavid Shaw1-7/+17
(build_sig_subpkt_from_sig), getkey.c (fixup_uidnode, merge_selfsigs_main, merge_selfsigs_subkey), keygen.c (keygen_add_key_expire): Fix meaning of key expiration and sig expiration subpackets - zero means "never expire" according to 2440, not "expire instantly".
2006-04-19Continued with merging.Werner Koch1-4/+3
Still does not build.
2006-04-19Merged with gpg 1.4.3 code. Werner Koch1-503/+598
The gpg part does not yet build.
2005-11-12* trustdb.h, trustdb.c (clean_key): New function to handle keyDavid Shaw1-24/+6
cleaning from one convenient place. * options.h, import.c (parse_import_options, clean_sigs_from_all_uids, import_one): Reduce clean options to two: clean and minimize. * parse-packet.c (setup_user_id): Remove. (parse_user_id, parse_attribute): Just use xmalloc_clear instead.
2005-09-02* parse-packet.c (enum_sig_subpkt, parse_signature,David Shaw1-12/+15
parse_attribute_subpkts): Make a number of warnings verbose items. These fire on many slightly mangled keys in the field, so the warning is becoming burdensome.
2005-07-28Implemented PKA trust modelWerner Koch1-0/+2
2005-07-27Converted all m_free to xfree etc.Werner Koch1-27/+27
2005-06-18(parse_signature): Use log_info for messagesWerner Koch1-2/+2
about missing timestamp or keyid. In case we don't use that key there won't be no further error and thus gpg does not need to return with an error.
2005-05-31Updated FSF street address and preparations for a release candidate.Werner Koch1-1/+2
2005-05-11* keygen.c (write_selfsigs): Rename from write_selfsig. Write the sameDavid Shaw1-7/+19
selfsig into both the pk and sk, so that someone importing their sk (which will get an autoconvert to the pk) won't end up with two selfsigs. (do_generate_keypair): Call it from here. * parse-packet.c (can_handle_critical_notation): New. Check for particular notation tags that we will accept when critical. Currently, that's only [email protected], since we know how to handle it (pass it through to a mail program). (can_handle_critical): Call it from here. (parse_one_sig_subpkt): Sanity check that notations are well-formed in that the internal lengths add up to the size of the subpacket.
2005-02-03Updated to match the switch to the NSIS installer.Werner Koch1-135/+159
2004-10-16* parse-packet.c (parse_one_sig_subpkt, enum_sig_subpkt): Don't BUG() onDavid Shaw1-10/+7
unknown subpackets. Rather, just return them silently.
2004-09-09* photoid.c: Include ttyio.h.Werner Koch1-26/+11
* parse-packet.c (skip_rest): Removed. Changed all callers to use the new iobuf_skip_reset. Orginal patch by Florian Weimer. * iobuf.c (iobuf_skip_rest): New. Orginal patch by Florian Weimer. Added new argument PARTIAL.
2004-07-15* g10.c (main): Alias --charset as --display-charset to help avoid theDavid Shaw1-2/+2
continuing confusion and make room for possible changes in devel. * parse-packet.c (parse_plaintext): Show the hex value for the literal packet mode since it may not be printable. * keygen.c (make_backsig): Make sure that the backsig was built successfully before we try and use it. * status.h, status.c (get_status_string), plaintext.c (handle_plaintext): New status tags PLAINTEXT and PLAINTEXT_LENGTH.
2004-04-23* keygen.c (make_backsig): If DO_BACKSIGS is not defined, do not createDavid Shaw1-3/+1
backsigs. * getkey.c (merge_selfsigs_subkey): Find 0x19 backsigs on subkey selfsigs and verify they are valid. If DO_BACKSIGS is not defined, fake this as always valid. * packet.h, parse-packet.c (parse_signature): Make parse_signature non-static so we can parse 0x19s in self-sigs. * main.h, sig-check.c (check_backsig): Check a 0x19 signature. (signature_check2): Give a backsig warning if there is no or a bad 0x19 with signatures from a subkey.