From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 053E06DE0E8C for ; Tue, 6 Aug 2019 06:09:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -2.501 X-Spam-Level: X-Spam-Status: No, score=-2.501 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hfvm3552wCRO for ; Tue, 6 Aug 2019 06:09:31 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id A63BB6DE0A7F for ; Tue, 6 Aug 2019 06:09:31 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1565096968; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=ziL+7gaFaIdgG5EQxFGf3bjg7DJb+LaevrzypL8i/T4=; b=y/abXjBOX6QMj6cE0Dw7qKVoSZtbEi307b264ChJvKXrV8MPrl39WoK2 xTMIJsGmcMtANBUHWRRYV2tgceHiCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1565096968; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=ziL+7gaFaIdgG5EQxFGf3bjg7DJb+LaevrzypL8i/T4=; b=EahG4l8nZqwdoOwSyFfrLrCCIBYLWwDHe/fD3TaNVwiiEORnMmKG53IV iRVhAahcdTdaMn8BmTo6ZsM+fDuo3vq/3G5KL90R9dB8gvN6ZfJ7rl+Un2 B+GcG1GmWSmsLiBN11ClBvlf8Ppygjd2AMOrr5qDTZqtQaV6Y/527ssOh1 9rAjEoKIZg9ZFvvjfJhEdqCjiFNNcAr1MYq8feaAtaHI+E3BgBcTt5uPIT XBpAxq+ak6yPI+BZ1BK5NSTF0aIHBv6rnH8vGYlrDX+ihLLagejgVKTriN CWjZdtPvSVINBPoCAXlecISXVmeKqfI3S9AtjfYbwwhC7xb0UhqXnQ== Received: from fifthhorseman.net (unknown [98.11.158.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id E655EF99D; Tue, 6 Aug 2019 09:09:27 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id ECB3A204C8; Tue, 6 Aug 2019 09:08:22 -0400 (EDT) From: Daniel Kahn Gillmor To: David Bremner , Notmuch Mail Subject: Re: [PATCH 5/7] util/repair: add _notmuch_repair_crypto_payload_skip_legacy_display In-Reply-To: <87blx6wa99.fsf@tethera.net> References: <20190625014107.12452-1-dkg@fifthhorseman.net> <20190625014107.12452-6-dkg@fifthhorseman.net> <87blx6wa99.fsf@tethera.net> Autocrypt: addr=dkg@fifthhorseman.net; prefer-encrypt=mutual; keydata= mDMEXEK/AhYJKwYBBAHaRw8BAQdAr/gSROcn+6m8ijTN0DV9AahoHGafy52RRkhCZVwxhEe0K0Rh bmllbCBLYWhuIEdpbGxtb3IgPGRrZ0BmaWZ0aGhvcnNlbWFuLm5ldD6ImQQTFggAQQIbAQUJA8Jn AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYhBMS8Lds4zOlkhevpwvIGkReQOOXGBQJcQsbzAhkB AAoJEPIGkReQOOXG4fkBAO1joRxqAZY57PjdzGieXLpluk9RkWa3ufkt3YUVEpH/AP9c+pgIxtyW +FwMQRjlqljuj8amdN4zuEqaCy4hhz/1DbgzBFxCv4sWCSsGAQQB2kcPAQEHQERSZxSPmgtdw6nN u7uxY7bzb9TnPrGAOp9kClBLRwGfiPUEGBYIACYWIQTEvC3bOMzpZIXr6cLyBpEXkDjlxgUCXEK/ iwIbAgUJAeEzgACBCRDyBpEXkDjlxnYgBBkWCAAdFiEEyQ5tNiAKG5IqFQnndhgZZSmuX/gFAlxC v4sACgkQdhgZZSmuX/iVWgD/fCU4ONzgy8w8UCHGmrmIZfDvdhg512NIBfx+Mz9ls5kA/Rq97vz4 z48MFuBdCuu0W/fVqVjnY7LN5n+CQJwGC0MIA7QA/RyY7Sz2gFIOcrns0RpoHr+3WI+won3xCD8+ sVXSHZvCAP98HCjDnw/b0lGuCR7coTXKLIM44/LFWgXAdZjm1wjODbg4BFxCv50SCisGAQQBl1UB BQEBB0BG4iXnHX/fs35NWKMWQTQoRI7oiAUt0wJHFFJbomxXbAMBCAeIfgQYFggAJhYhBMS8Lds4 zOlkhevpwvIGkReQOOXGBQJcQr+dAhsMBQkB4TOAAAoJEPIGkReQOOXGe/cBAPlek5d9xzcXUn/D kY6jKmxe26CTws3ZkbK6Aa5Ey/qKAP0VuPQSCRxA7RKfcB/XrEphfUFkraL06Xn/xGwJ+D0hCw== Date: Tue, 06 Aug 2019 09:08:22 -0400 Message-ID: <87mugmphkp.fsf@fifthhorseman.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 13:09:33 -0000 --=-=-= Content-Type: text/plain Hi Bremner-- thanks for the review! On Sat 2019-08-03 12:15:30 -0300, David Bremner wrote: > Daniel Kahn Gillmor writes: > >> + ret = true; >> + for (int i = 0; i < g_mime_header_list_get_count (legacy_display_headers); i++) { >> + GMimeHeader *dh = g_mime_header_list_get_header_at (legacy_display_headers, i); >> + if (dh == NULL) { >> + ret = false; >> + break; >> + } > > I can live with the use of break if you think it's superior, but I think > the idiom of "goto DONE" is more common in the notmuch codebase. I > personally always have think about the semantics of "break" and > "continue" in C pretty carefully. i thought i was the only one who got confused between "break" and "continue"! I will convert to goto DONE, i agree it's more readable. >> + if (strcmp (g_mime_header_get_value (dh), g_mime_header_get_value (ph))) { >> + ret = false; >> + break; >> + } > > It's not really clear to me what kind of "invalid" causes > g_mime_header_get_value to return NULL. Maybe this strcmp should be > guarded against that? i think it's impossible in the current implementation for this to go wrong, since we've already got a GMimeHeader object from an existing block of headers, but i'll add some protection just in case GMime changes its implementation or some fuzzer constructs a truly devious not-quite-RFC-822 input. --dkg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQTJDm02IAobkioVCed2GBllKa5f+AUCXUl7xgAKCRB2GBllKa5f +NJ+AQCoznkiJHL5Nry/ilgqtmQKzHS8PStURIfqRGb9Ryl1ZQD/d+l3r3Hyi+XJ yT/uO1I40LF9rWJouuMCf5/AzkKlHQ8= =GkKy -----END PGP SIGNATURE----- --=-=-=--