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 6D52347E86 for ; Mon, 30 Oct 2023 00:33:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F12B368CCAF; Mon, 30 Oct 2023 02:33:35 +0200 (EET) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 744F268CC18 for ; Mon, 30 Oct 2023 02:33:29 +0200 (EET) Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-671188b2d44so4050936d6.0 for ; Sun, 29 Oct 2023 17:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698626008; x=1699230808; 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=CuSg2QSIxODsoJv6OBDHKPm4M8kYCDr8ePR4hFFJAbo=; b=gz6hpD9Eb/5aNOqKp5GYe3Z0c0K6w0woK2opWIBnn9tfMlv+iYa/R+6vvm7pjoEnk5 xQ7SNc1SRXSF6CDGe+4P/dRmQ0U0V9YZ/rwHKT2LGpjqD/73HyB+YT06saItQKXrs6sd 2k6c8Xy+DdcLc9XK/Ne2WNWT5M0EFg6EGNdK90LNP4P3pdVuXeeQkldFhWCQ7Po3wcHC NiWhV/bLJLvVLxoGw06WMMlThTyNEIMQ4pAIRaVXXpj//Do+u94X7LHuNbsH2Pbgj1s6 ydzC+dL+9p3ekHKUHDl5pEzY4P+KLW7yvjYCbsBYt7fhqSSh+L7q5xMSAFTosvulmkx7 joPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698626008; x=1699230808; 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=CuSg2QSIxODsoJv6OBDHKPm4M8kYCDr8ePR4hFFJAbo=; b=O4GWsWBWas4NGkjD84+oFkACso3Ops1W/MBApro1wO07PoSBGezVPqAq5puATkLG+n mqwsRmQo7hkDBOJnL00NCOZecF2qSBZGX3ZQ9vx272O/5GyE7cOveDJOM4iG+LFrj7Mz nsas7bMUEb7e9a8o4Tnh1SOrlD1+dozEFzBUrg+7dO9GjdAW58qo3uTNvrYAlcaDnGS3 2aC9l3RjoYetHcS32IrxFnMoaAsEZAjjWtRVCv0tVIJULdxWSrk9cLa6Iif6d2tk/7UZ 5guyrJYlBR5zK/Abn8UOvyd/lZ7g88YVy0fenJBenjhs0TTJqqhVUKZk9Bz4vFb0bAqZ J4mA== X-Gm-Message-State: AOJu0Yw7oO4CpU0vPjBuiWJwJQ2JXA5Un0656ub06EZH5AJnowVtxoXN 94YZ33Zyr30mU9evC0JiaekXOQeXwyLnAg== X-Google-Smtp-Source: AGHT+IH6snOK/pfWaFJBD1WfHVDcFJkA/ClbqCPgr8EnobS05aO45Ioi66oNii7NDyhRZQnh9HTATw== X-Received: by 2002:a05:6214:4405:b0:66d:1178:8729 with SMTP id oj5-20020a056214440500b0066d11788729mr9141836qvb.0.1698626007863; Sun, 29 Oct 2023 17:33:27 -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 l2-20020ad44242000000b00671248b9cfcsm1694005qvq.67.2023.10.29.17.33.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Oct 2023 17:33:27 -0700 (PDT) Message-ID: <8943e8c0-f382-4b54-8761-4ce57866bf5f@gmail.com> Date: Sun, 29 Oct 2023 20:33:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US-large To: ffmpeg-devel@ffmpeg.org References: <20231029124723.398581-1-leo.izen@gmail.com> From: Leo Izen In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v2] 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/29/23 20:23, Andreas Rheinhardt wrote: > Leo Izen: >> Avoids a -Wstringop-truncation warning by using av_strlcopy instead of >> strncpy. >> >> Signed-off-by: Leo Izen >> --- >> libavformat/hls.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libavformat/hls.c b/libavformat/hls.c >> index f5f549b24d..39440176c9 100644 >> --- a/libavformat/hls.c >> +++ b/libavformat/hls.c >> @@ -543,8 +543,8 @@ static struct rendition *new_rendition(HLSContext *c, struct rendition_info *inf >> int langlen = strlen(rend->language); >> if (langlen < sizeof(rend->language) - 3) { >> rend->language[langlen] = ','; >> - strncpy(rend->language + langlen + 1, info->assoc_language, >> - sizeof(rend->language) - langlen - 2); >> + av_strlcpy(rend->language + langlen + 1, info->assoc_language, >> + sizeof(rend->language) - langlen - 1); >> } >> } >> > > As I said before: You are merely hiding the truncation issue instead of > fixing it. > I don't see how? It will only be truncated if info->assoc_language is very very long, and in that case it won't fit inside a 64-byte buffer so it will *have* to be truncated. But it will be nul-terminated in either case, so there's no real difference between the old and new code, other than the warning. _______________________________________________ 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".