1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/lib
Douglas Bagnall 103d248bee util/charset/convert: do not pretend to realloc
It seems very likely that our clever attempts to dynamically realloc
the output buffer were never triggered. Two lines of reasoning lead to
this conclusion:

1. We allocate 3 * srclen to start with, but no conversion we use will
   more than that. To be precise, from 8-bit charsets we will only deal
   with codepoints in the Unicode basic multilingual plane (up to 0xFFFF).

   These can all be expressed as 3 or fewer utf-8 bytes. In UTF16 they
   are naturally 2 bytes, while in the DOS codes they are 1 byte.

   We have checked the code tables, and can not find a plausible
   (e.g. not EBCDIC) DOS code page or unix charset that is outside
   this range.  Clients cannot chose the code page, the only code
   pages we will use come from 'unix charset' and 'dos charset'
   smb.conf parameters.

   Therefore the worst that can possibly happen is we expand 1 byte into 3
   (specifically, when converting some e.g. CP850 codepoints to UTF-8).

2. If the reallocation was ever used, the results would have been
   catastrophically wrong, as the input pointer was not reset.

Therefore we skip the complication of the goto loop and let E2BIG be
just another impossible error to report.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-15 04:03:37 +00:00
..
addns addns: Remove some unused defines 2019-02-27 01:35:18 +01:00
afs lib: Use dom_sid_str_buf 2018-12-11 00:40:30 +01:00
async_req lib/async_req/async_sock.c set socket close on exec 2017-12-18 04:38:19 +01:00
audit_logging lib:audit_logging: Use C99 initializer for server_id in audit_logging 2019-04-29 16:04:28 +00:00
compression lib:compression: Fix undefined behavior in lzxpress 2018-11-22 22:13:27 +01:00
crypto lib:crypto: Remove unused SHA512 2019-05-07 03:04:30 +00:00
dbwrap dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions 2019-05-08 16:33:25 +00:00
krb5_wrap krb5_wrap: Only use the required md4 header 2019-02-27 07:59:27 +00:00
ldb ldb: Release ldb 2.0.1 2019-05-15 04:03:37 +00:00
ldb-samba common-lib: Update error check for new string conversion wrapper 2019-04-11 22:29:27 +00:00
mscat waf: Move gnutls_pkcs7_get_embedded_data_oid to main gnutls file 2019-04-30 23:18:27 +00:00
param smbd: Move deadtime default to parameter definition and man page 2019-05-01 03:12:07 +00:00
printer_driver lib:printer_driver: Retrieve Class value 2019-01-28 15:44:18 +01:00
pthreadpool Revert "pthreadpool: split out pthreadpool_tevent_job from pthreadpool_tevent_job_state" 2019-01-11 23:11:14 +01:00
replace replace: Fix "make test" to actually test libreplace 2019-05-06 05:46:11 +00:00
smbconf waf: add library dependency for sendfile on Solaris 2019-02-17 13:33:15 +01:00
socket lib:socket: If returning early, set ifaces 2018-10-28 00:35:34 +02:00
talloc talloc torture: avoid NULL dereference 2019-05-09 22:39:26 +00:00
tdb tdbtool: avoid theoretical NULL dereference (CID 1361462) 2019-05-09 22:39:27 +00:00
tdb_wrap tdb_wrap: Use a struct initializer 2015-07-23 14:39:18 +02:00
tdr lib: Fix 1354521 Unchecked return value 2016-03-01 21:49:44 +01:00
tevent tevent: Release tevent 0.10.0 2019-03-21 04:06:16 +00:00
texpect lib/texpect: avoid theoretical NULL dereference (CID 1273099) 2019-05-09 22:39:27 +00:00
torture lib:torture: Fix string comparison macros where we directly pass NULL 2019-05-08 16:33:24 +00:00
tsocket tsocket: Simplify tsocket.h 2019-03-22 18:02:17 +00:00
util util/charset/convert: do not pretend to realloc 2019-05-15 04:03:37 +00:00
README various: Remove references to about to be deleted thirdparty/dnspython 2018-12-11 20:07:18 +01:00
wscript_build Remove 'external' python module support code - use the third_party directory instead. 2015-03-06 04:41:48 +01:00

compression - Various compression algorithms (MSZIP, lzxpress)
popt - Command-line option parsing library
replace - Provides replacements for standard (POSIX, C99) functions 
          not provided by the host platform.
subunit - Utilities and bindings for working with the Subunit test result 
          reporting protocol.
talloc - Hierarchical pool based memory allocator 
tdb - Simple but fast key/value database library, supporting multiple writers
torture - Simple unit testing helper library