Re: [Cbor] Robert Wilton's No Objection on draft-ietf-cbor-file-magic-11: (with COMMENT)

Michael Richardson <mcr+ietf@sandelman.ca> Sat, 23 April 2022 16:02 UTC

Return-Path: <mcr@sandelman.ca>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4B6BC3A118D; Sat, 23 Apr 2022 09:02:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.907
X-Spam-Level:
X-Spam-Status: No, score=-1.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QaUvXegiCBwW; Sat, 23 Apr 2022 09:02:47 -0700 (PDT)
Received: from relay.sandelman.ca (relay.cooperix.net [176.58.120.209]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 029C63A1181; Sat, 23 Apr 2022 09:02:44 -0700 (PDT)
Received: from dooku.sandelman.ca (unknown [75.98.19.153]) by relay.sandelman.ca (Postfix) with ESMTPS id DD47C1F456; Sat, 23 Apr 2022 16:02:41 +0000 (UTC)
Received: by dooku.sandelman.ca (Postfix, from userid 179) id 1F3E71A0291; Sat, 23 Apr 2022 12:02:39 -0400 (EDT)
From: Michael Richardson <mcr+ietf@sandelman.ca>
To: Carsten Bormann <cabo@tzi.org>, Robert Wilton <rwilton@cisco.com>, =?utf-8?Q?Christian_Ams=C3=BCss?= <christian@amsuess.com>, cbor@ietf.org, draft-ietf-cbor-file-magic@ietf.org, The IESG <iesg@ietf.org>, cbor-chairs@ietf.org
In-reply-to: <1560B380-1BB5-498F-BF33-F57B85478052@tzi.org>
References: <165055913687.10023.13183316329683102967@ietfa.amsl.com> <1560B380-1BB5-498F-BF33-F57B85478052@tzi.org>
Comments: In-reply-to Carsten Bormann <cabo@tzi.org> message dated "Thu, 21 Apr 2022 19:07:36 +0200."
X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 26.3
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha512"; protocol="application/pgp-signature"
Date: Sat, 23 Apr 2022 12:02:39 -0400
Message-ID: <1300566.1650729759@dooku>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/lG6lN3g8IhMhwhuqepxEiZDHTp4>
Subject: Re: [Cbor] Robert Wilton's No Objection on draft-ietf-cbor-file-magic-11: (with COMMENT)
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 23 Apr 2022 16:02:53 -0000

Carsten Bormann <cabo@tzi.org> wrote:
    >> I was less convinced by this statement because: (1) It seems like C
    >> treating this as null terminated string is probably not the right
    >> thing to do,

    > It is not, but I have seen too much code doing that with magic numbers
    > (strncpy, that is).

    >> I'm not sure that we should be implicitly endorsing that.

    > Of course, we could decide that we make zero bytes prominent enough and
    > mention that strncpy is not the way to do this.

It's not the sensible CBOR-aware code that would be treating the magic number
as a string, it's the non-CBOR-aware code that just wants some pattern to
deal with where the null/zero bytes become annoying to encode.

And: it's just mild advice.
Of course, code should all be proof against such things.

--
Michael Richardson <mcr+IETF@sandelman.ca>, Sandelman Software Works
 -= IPv6 IoT consulting =-