[vlc-devel] [PATCH] vorepository: use vlc_mkstemp instead of tempnam
Lyndon Brown
jnqnfe at gmail.com
Sun Sep 27 22:31:08 CEST 2020
attached. preview:
From: Lyndon Brown <jnqnfe at gmail.com>
Date: Fri, 29 Mar 2019 14:18:39 +0000
Subject: vorepository: use vlc_mkstemp instead of tempnam
resolves compile warning about insecure function
diff --git a/modules/misc/addons/vorepository.c b/modules/misc/addons/vorepository.c
index 06f02ce239..3bafbc6a85 100644
--- a/modules/misc/addons/vorepository.c
+++ b/modules/misc/addons/vorepository.c
@@ -400,7 +400,7 @@ static int Retrieve( addons_finder_t *p_finder, addon_entry_t *p_entry )
FREENULL( p_finder->p_sys->psz_tempfile );
}
- p_finder->p_sys->psz_tempfile = tempnam( NULL, "vlp" );
+ p_finder->p_sys->psz_tempfile = strdup( DIR_SEP"tmp"DIR_SEP PACKAGE_NAME"-vlp.XXXXXX" );
if ( !p_finder->p_sys->psz_tempfile )
{
msg_Err( p_finder, "Can't create temp storage file" );
@@ -408,8 +408,8 @@ static int Retrieve( addons_finder_t *p_finder, addon_entry_t *p_entry )
return VLC_EGENERIC;
}
- int fd = vlc_open( p_finder->p_sys->psz_tempfile,
- O_WRONLY | O_CREAT | O_EXCL, 0600 );
+ int fd = vlc_mkstemp( p_finder->p_sys->psz_tempfile );
+
if( fd == -1 )
{
msg_Err( p_finder, "Failed to open addon temp storage file" );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorepository_mkstemp.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200927/88e72c54/attachment.bin>
More information about the vlc-devel
mailing list