aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-04-14 11:53:55 +0000
committerWerner Koch <[email protected]>2022-04-14 11:53:55 +0000
commitc8c71fc7161bf6b553bc5b45b2f7a06f8a1a4639 (patch)
tree4e4654596ba614b56a2d705a73ed9b9e6f67647b
parentscd: Minor code reorganization (diff)
downloadgnupg-c8c71fc7161bf6b553bc5b45b2f7a06f8a1a4639.tar.gz
gnupg-c8c71fc7161bf6b553bc5b45b2f7a06f8a1a4639.zip
gpg: Replace an assert by a log_fatal.
* g10/build-packet.c (do_signature): Use log_fatal. -- GnuPG-bug-id: 5809
-rw-r--r--g10/build-packet.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 14e40a1bf..266bf54e4 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -1504,9 +1504,12 @@ do_signature( IOBUF out, int ctb, PKT_signature *sig )
{
iobuf_put( a, 3 );
- /* Version 3 packets don't support subpackets. */
- log_assert (! sig->hashed);
- log_assert (! sig->unhashed);
+ /* Version 3 packets don't support subpackets. Actually we
+ * should never get to here but real life is different and thus
+ * we now use a log_fatal instead of a log_assert here. */
+ if (sig->hashed || sig->unhashed)
+ log_fatal ("trying to write a subpacket to a v3 signature (%d,%d)\n",
+ !!sig->hashed, !!sig->unhashed);
}
else
iobuf_put( a, sig->version );