[cmp] update Bled to latest

* Also fix a possible buffer overflow in msapi_utf8.h
This commit is contained in:
Pete Batard 2015-09-05 18:22:52 +01:00
parent ff9eae4e6d
commit 67081fac6e
7 changed files with 21 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/*
* Bled (Busybox Library for Easy Decompression)
* Bled (Base Library for Easy Decompression)
*
* Copyright © 2014-2015 Pete Batard <pete@akeo.ie>
*

View File

@ -1,5 +1,5 @@
/*
* Bled (Busybox Library for Easy Decompression)
* Bled (Base Library for Easy Decompression)
*
* Copyright © 2014-2015 Pete Batard <pete@akeo.ie>
*

View File

@ -52,7 +52,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
goto ret;
}
/* Proceed with deleting */
if (unlink(file_header->name) == -1
if (_unlink(file_header->name) == -1
&& errno != ENOENT
) {
bb_perror_msg_and_die("can't remove old file %s",
@ -78,7 +78,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
data_skip(archive_handle);
goto ret;
}
else if ((unlink(file_header->name) == -1) && (errno != EISDIR)) {
else if ((_unlink(file_header->name) == -1) && (errno != EISDIR)) {
bb_perror_msg_and_die("can't remove old file %s",
file_header->name);
}
@ -116,12 +116,11 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
/* rpm-style temp file name */
dst_name = xasprintf("%s;%x", dst_name, (int)getpid());
#endif
dst_fd = open(dst_name, flags, file_header->mode);
if (dst_fd < 0) {
if (_sopen_s(&dst_fd, dst_name, flags, _SH_DENYNO, file_header->mode) != 0) {
bb_perror_msg_and_die("can't open file %s", dst_name);
}
bb_copyfd_exact_size(archive_handle->src_fd, dst_fd, file_header->size);
close(dst_fd);
_close(dst_fd);
#ifdef ARCHIVE_REPLACE_VIA_RENAME
if (archive_handle->ah_flags & ARCHIVE_REPLACE_VIA_RENAME) {
xrename(dst_name, file_header->name);
@ -192,7 +191,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
* it has lchmod which seems to do nothing!
* so we use chmod... */
if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_PERM)) {
(void)chmod(file_header->name, file_header->mode);
(void)_chmod(file_header->name, file_header->mode);
}
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
struct timeval t[2];

View File

@ -919,6 +919,7 @@ static int inflate_block(STATE_PARAM smallint *e)
}
default:
abort_unzip(PASS_STATE_ONLY);
return 0;
}
}

View File

@ -1,7 +1,7 @@
/*
* Library header for busybox
* Library header for busybox/Bled
*
* Rewritten for Bled (Busybox Library for Easy Decompression)
* Rewritten for Bled (Base Library for Easy Decompression)
* Copyright © 2014-2015 Pete Batard <pete@akeo.ie>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
@ -20,9 +20,6 @@
#error Only Windows platforms are supported
#endif
#if defined(_MSC_VER)
#pragma warning(disable: 4715) // not all control paths return a value
#pragma warning(disable: 4996) // Ignore deprecated
#if defined(DDKBUILD)
#pragma warning(disable: 4242) // "Conversion from x to y, possible loss of data"
#pragma warning(disable: 4244)
@ -31,7 +28,6 @@ struct timeval {
long tv_usec;
};
#endif
#endif
#include "platform.h"
#include "msapi_utf8.h"
@ -197,7 +193,12 @@ static inline int full_read(int fd, void *buf, size_t count) {
}
static inline struct tm *localtime_r(const time_t *timep, struct tm *result) {
#if defined(DDKBUILD)
result = localtime(timep);
#else
if (localtime_s(result, timep) != 0)
result = NULL;
#endif
return result;
}

View File

@ -802,7 +802,7 @@ static __inline char* getenvU(const char* varname)
wchar_t value[256];
size_t value_size;
// MinGW and WDK don't know wdupenv_s, so we use wgetenv_s
_wgetenv_s(&value_size, value, sizeof(value), wvarname);
_wgetenv_s(&value_size, value, ARRAYSIZE(value), wvarname);
ret = wchar_to_utf8(value);
wfree(varname);
return ret;

View File

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.4.724"
CAPTION "Rufus 2.4.725"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -317,8 +317,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,4,724,0
PRODUCTVERSION 2,4,724,0
FILEVERSION 2,4,725,0
PRODUCTVERSION 2,4,725,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -335,13 +335,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.4.724"
VALUE "FileVersion", "2.4.725"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.4.724"
VALUE "ProductVersion", "2.4.725"
END
END
BLOCK "VarFileInfo"