Commit 145b0573 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

update: avoid division by zero

If the downloaded file is empty or of unknown size.
parent afceeaf9
......@@ -471,7 +471,7 @@ bool update_NeedUpgrade( update_t *p_update )
* \param l_size the size in bytes
* \return the size as a string
*/
static char *size_str( long int l_size )
static char *size_str( uint64_t l_size )
{
char *psz_tmp = NULL;
int i_retval = 0;
......@@ -526,8 +526,8 @@ static void* update_DownloadReal( void *obj )
{
update_download_thread_t *p_udt = (update_download_thread_t *)obj;
dialog_progress_bar_t *p_progress = NULL;
long int l_size;
long int l_downloaded = 0;
uint64_t l_size;
uint64_t l_downloaded = 0;
float f_progress;
char *psz_status;
char *psz_downloaded = NULL;
......@@ -556,7 +556,8 @@ static void* update_DownloadReal( void *obj )
}
/* Get the stream size */
l_size = stream_Size( p_stream );
if( stream_GetSize( p_stream, &l_size ) || l_size == 0 )
goto end;
/* Get the file name and open it*/
psz_tmpdestfile = strrchr( p_update->release.psz_url, '/' );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment