From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id 10A4924E88 for ; Tue, 23 Jan 2024 22:28:50 +0100 (CET) Received: from mail.posixcafe.org ([45.76.19.58]) by 9front; Tue Jan 23 16:27:27 -0500 2024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posixcafe.org; s=20200506; t=1706045266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D6LfOVEx9n81/sBrW94XuTuaxD/YgNXfaOKOZHs3yq4=; b=GkmtqTGes7RERXTs0Q6/mXWEMDBpN+WT8gWd6Gg3S9FZ6W7S4krULQaCxaHrANsAreQzCO ORadX43mmiZYmJUFpUW1+iSrzZkRjRvqUY/1ydABcSNeBxLRO6cvzIJmDwUD4j7IBcdi4Z eaJ0OT/W81DqdqAuFD3JqNCg6upZQM0= Received: from [192.168.168.200] ( [207.45.82.38]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 9a41b9ab (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9front@9front.org>; Tue, 23 Jan 2024 15:27:44 -0600 (CST) Message-ID: Date: Tue, 23 Jan 2024 15:27:22 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: 9front@9front.org References: <71eb82f2-3818-4b0c-b4cc-d9976c1b6c2f@gmail.com> From: Jacob Moody In-Reply-To: <71eb82f2-3818-4b0c-b4cc-d9976c1b6c2f@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: distributed RESTful replication polling interface Subject: Re: [9front] [PATCH] awk: don't write an extra NUL past the end of a block Reply-To: 9front@9front.org Precedence: bulk Thanks! I committed the solution from onetrueawk. On 1/23/24 12:32, Kristo wrote: > On 23.1.2024 18.53, Jacob Moody wrote: >> Maybe give onetrueawk a try and see if you can reproduce the >> crash there as well, and if not perhaps we should copy their fix. > > Not sure why I didn't realize to do this while debugging, indeed their > fix seems to be to allocate one more byte few lines above. > > if ((fields = (char *) malloc(n+2)) == NULL) /* possibly 2 final \0s */ > > https://github.com/onetrueawk/awk/blob/master/lib.c#L394 > > I'm in favor of copying their fix as I can't say that I have a super > deep understanding of awk's internals. > > Kristo