From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id EB4F747D8F for ; Thu, 26 Oct 2023 12:02:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2BA7768CA89; Thu, 26 Oct 2023 15:02:00 +0300 (EEST) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF29268C9E6 for ; Thu, 26 Oct 2023 15:01:53 +0300 (EEST) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-66d501d3ffbso1819416d6.1 for ; Thu, 26 Oct 2023 05:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698321712; x=1698926512; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VVJynWJ5WZ4EHxEQrVYjoeNxYBeM/0VIx97XHDK65kE=; b=SRjg9+4G4wLuaGCUVxnXS1HFU2CTX6zfY08b0RadQcY/o5Z+4sEI5E2FdK6eamdTdQ iE7wSm6/lxyWc2euSGylL/mz54lc0cZzamlh08LKQQJ9HSSiK322/eaFqWMGPAhyyW5o TlXQ5uVfnNTCCQ4uoX6+9BtCk2eyut6+YmUq9+cbCFFmj8VZTRgxtimtUyi0AZBX/I4L bAx24cxAAFXnjHo6N5QBpZFGuYHoKdZlP2RwnjCY6teworebRkOf3cStGGQL9a/qYNr2 NoOl+vR97pOiWhQYlXKcxNxgG+7EIu8ggbpFfar84wcaDITxeKFl8/BgeBaeXAPy8uVX mOVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698321712; x=1698926512; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VVJynWJ5WZ4EHxEQrVYjoeNxYBeM/0VIx97XHDK65kE=; b=sSsWBmUGDnmbpEuiRRztCj53uA5+W3ty5LTg4O+fVNZD8KnBFzqsNWCDcTPB6i7RfA /1MmwDFu0N1iL82KP02k7F7TOoNg8HpOe9o8Dw+RT5Ye5wdq8WlqIWDsVek+0JbMiN8J xcc1I6OxbT+AOR5ULFaSS3XDvq/rvQtwLU5PjFWVAYnv21yI2WEE6UsVyw2RRVoe8moK AIJLsyFQySIrX2LgxcYnoicrEOsoF/quy8iVACWTF380Do3dB/L9QIInk/Sx2RjhXyLS jo2w9ADVKuFDFUTJWZaXHmkGOzlsRMVNZpCZOBDfY36zfzww4AUGS1QMm/zWfoTcczEq 4N/g== X-Gm-Message-State: AOJu0YzjL4TjrJZB01HSY8YOgSlwXJCgnz5XgfrKuILEqv2SJeWn8pBi YBIv00ODaP1oTazVv77B9NlShJ3Js7iapA== X-Google-Smtp-Source: AGHT+IF/y/YdkgTew2BwbPY7ZC2iWn2zMjoTiFbK51b84kjxUiejowv1gX2dLEqUK1R7jyhEHo4y4A== X-Received: by 2002:a05:6214:3382:b0:66d:1b4e:77d6 with SMTP id mv2-20020a056214338200b0066d1b4e77d6mr18177172qvb.5.1698321711742; Thu, 26 Oct 2023 05:01:51 -0700 (PDT) Received: from [192.168.1.35] (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id lf18-20020a0562142cd200b0065b21b232bfsm5141978qvb.138.2023.10.26.05.01.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Oct 2023 05:01:50 -0700 (PDT) Message-ID: <4e372186-3b34-4df3-a0be-79d15054adb9@gmail.com> Date: Thu, 26 Oct 2023 08:01:49 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US-large To: ffmpeg-devel@ffmpeg.org References: <20231026031427.150182-1-leo.izen@gmail.com> <0b8dd24b-ee83-4832-a830-9b33bfad62c8@gmail.com> From: Leo Izen In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avformat/hls: use av_strlcopy instead of strncpy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 10/26/23 07:32, Andreas Rheinhardt wrote: > > This case can't happen here, because it only copies > "sizeof(rend->language) - langlen - 2" bytes at most from position where > sizeof(rend->language) - langlen - 1 are available, so the initial > trailing \0 never gets touched. You did not touch the size part of the > call, so you effectively only use sizeof(rend->language) - 1 bytes of > the buffer, thereby making the truncation issue worse. And even if you > fixed this part, you would still just have silenced the truncation > instead of fixing it. > > - Andreas > Truncation can happen if info->assoc_language is very long, i.e. uses the full buffer (63 chars plus a 64th for nul). In that case, strncpy will truncate, but because there's a -2 in the size argument, instead of -1, the resulting buffer will still be nul-terminated. The compiler doesn't know this, so it produces a warning. It seems the appropriate fix here is to change strncpy to av_strlcpy but also change the -2 to a -1. This will produce identical behavior to before, but it won't cause the compiler to produce a warning that the string might not be nul-terminated (cause it will always be). - Leo Izen (Traneptora) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".