Commit Graph

1675 Commits

Author SHA1 Message Date
Armin Novak
6ed7b7b4b3 Fixed a resource leak. 2015-06-24 09:29:52 +02:00
Armin Novak
f177430acc Fixed a resource leak. 2015-06-24 09:29:13 +02:00
Armin Novak
6698e24228 Fixed leaks, NULL dereferences and broken init. 2015-06-23 21:29:21 +02:00
Armin Novak
fbbc1affd0 ifdef variables used with specific build options. 2015-06-23 16:20:59 +02:00
Armin Novak
063b10e8e4 Fixed memory leak. 2015-06-23 12:30:19 +02:00
Bernhard Miklautz
af81a91ea7 windows: fix compilation and warnings 2015-06-22 19:31:25 +02:00
Bernhard Miklautz
06502e6a91 misc: integrate pull request feedback 2015-06-22 19:24:30 +02:00
Bernhard Miklautz
fc6a3cf3c1 sspi/ntlm: integrate pull request comments 2015-06-22 19:23:58 +02:00
Bernhard Miklautz
1b8dd139a9 cmd line: add missing checks
* strdup
* some allocs
2015-06-22 19:23:57 +02:00
David FORT
7c3f8f33ab Fixes for malloc / calloc + other fixes
This patch contains:

* checks for malloc return value + treat callers;
* modified malloc() + ZeroMemory() to calloc();
* misc fixes of micro errors seen during the code audit:
** some invalid checks in gcc.c, also there were some possible
integer overflow. This is interesting because at the end the data are parsed
and freed directly, so it's a vulnerability in some kind of dead code (at least
useless);
** fixed usage of GetComputerNameExA with just one call, when 2 were used
in misc places. According to MSDN GetComputerNameA() is supposed to return
an error when called with NULL;
** there were a bug in the command line parsing of shadow;
** in freerdp_dynamic_channel_collection_add() the size of array was multiplied
by 4 instead of 2 on resize
2015-06-22 19:21:47 +02:00
David FORT
16d36e3083 A malloc() pass on WinPR
This patch treats remaining non-checked mallocs. And changes to calloc in places
where it makes sense
2015-06-22 19:10:00 +02:00
Bernhard Miklautz
77927c213e android: fix misc compiler warnings
with gcc version arm-linux-androideabi-gcc (GCC) 4.8
2015-06-22 19:09:59 +02:00
Bernhard Miklautz
7d49893ddf winpr/wtsapi: disable tests that block on windows 2015-06-22 19:09:59 +02:00
Bernhard Miklautz
ab8d83c8fc winpr/thread: fix test compilation on windows
Use DWORD instead of QWORD.
2015-06-22 19:09:59 +02:00
Bernhard Miklautz
bf73f4e4f1 Fix unchecked strdups
* add missing checks
* adapt function return values where necessary
* add initial test for settings
2015-06-22 19:09:59 +02:00
Marc-André Moreau
3b3ffce042 Merge pull request #2705 from akallabeth/sspi_fix_v2
Sspi fix v2 - Fixes static build
2015-06-22 10:19:22 -04:00
Marc-André Moreau
093aaa4dc0 Merge pull request #2636 from xhaakon/master
Fix crashes in shadow server
2015-06-22 09:15:37 -04:00
Hardening
c8731eaa2c Merge pull request #2706 from nfedera/nf-fix-reset-event
winpr/synch: fix ResetEvent & improve CTest
2015-06-18 09:28:31 +02:00
Vic Lee
2e11eac79a Merge pull request #2675 from akallabeth/path_make_path
Added PathMakePath function.
2015-06-18 02:43:47 +00:00
Norbert Federa
f503f4cf0b winpr/synch: fix ResetEvent & improve CTest
Unless there is an invalid parameter or internal error, ResetEvent
must return TRUE, even if the object is in nonsignaled state.

Also fixed and improved the CTest TestSynchEvent to test for the
expected/correct SetEvent and ResetEvent return values.
2015-06-17 14:13:28 +02:00
Armin Novak
5dff9c4f9e Removed duplicate function tables, respecting WITH_NATIVE_SSPI 2015-06-17 13:24:11 +02:00
Vic Lee
145fc10412 Merge pull request #2687 from akallabeth/known_hosts_v2
Store SSL fingerprints with host and port
2015-06-12 12:52:53 +00:00
Bernhard Miklautz
e8d41c8516 Merge pull request #2682 from nfedera/fix-hresult-winpr-path
winpr/path: more PathCch* fixes
2015-06-11 12:47:10 +02:00
Vic Lee
ad4cdf8810 winpr: add high-precision GetTickCountPrecise for Windows. 2015-06-11 15:11:19 +08:00
Armin Novak
d6e1a0a25f Added StrSep function. 2015-06-09 15:32:50 +02:00
Armin Novak
db7753bc8b Added RemoveDirectoryA, clean up test directories. 2015-06-09 13:16:28 +02:00
Armin Novak
7403cdc60c Added PathMakePath function. 2015-06-09 13:16:28 +02:00
Bernhard Miklautz
07407927c2 Merge pull request #2670 from akallabeth/windows_config_paths
Adjusted config paths
2015-06-09 12:35:45 +02:00
Norbert Federa
cdabfcf9e1 winpr/path: Denounce PathAllocCombine and more
Note: This commit does NOT really fix PathAllocCombine!

- print a warning message that the function is buggy and added a code
  comment describing the issues
- fix misuse of the S_FALSE HRESULT in error conditions
- prevent some segfaults
- check result of HeapAlloc

Fortunately PathAllocCombine is unused in FreeRDP
2015-06-08 14:33:19 +02:00
Norbert Federa
6823cb4a86 winpr/path: PathCchConvertStyle used S_FALSE
Use E_FAIL instead of S_FALSE which was used to indicate errors
although it is a HRESULT success code.
2015-06-08 14:33:19 +02:00
Norbert Federa
b93a25a9af winpr/path: umimplemented tests print a warning 2015-06-08 14:33:19 +02:00
Norbert Federa
d383f95335 winpr/path: unimpl. functions should not succeed
Unimplemented PathCch* functions now return E_NOTIMPL instead of the
HRESULT S_OK and print an error message.
2015-06-08 14:33:19 +02:00
Norbert Federa
c4cd60110a winpr: fix PathCchFindExtension
Fix multiple inplementation errors including the incorrect usage of S_FALSE.
Make this function behave like the Windows 8 implementation and
the according MSDN specification.

- return S_OK if the extension was NOT found
- if no extension was found, ppszExt must point to the string's terminating null
- return E_INVALIDARG if pszPath is not null-terminated within the cchPath range
- return E_INVALIDARG if pszPath is NULL
- return E_INVALIDARG if ppszExt is NULL
- return E_INVALIDARG if cchPath is Zero
- return E_NOTIMPL instead of S_OK in PathPathCchFindExtensionW()

Also extended/fixed the TestPathCchFindExtension ctest
2015-06-08 14:33:19 +02:00
Norbert Federa
178afd8dd5 winpr: fix PathCchAppend
Fix incorrect usage of S_FALSE which was used to indicate errors
although it is a HRESULT success code.
Make this function behave like the Windows 8 implementation and
the according MSDN specification.

- return E_INVALIDARG instead of S_FALSE if pszPath is NULL
- return E_INVALIDARG instead of S_FALSE if pszMore is NULL
- return E_INVALIDARG if cchPath is zero
- return E_INVALIDARG if cchPath is greater than PATHCCH_MAX_CCH
- return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) if the combined
  path size exceeds cchPath (this is the same HRESULT which the Windows
  implementation returns in this case and which is referred to as
  PATHCCH_E_FILENAME_TOO_LONG on msdn)

Also extended/fixed the TestPathCchAppend ctest
2015-06-03 16:06:02 +02:00
Norbert Federa
92b0076c53 winpr: fix PathCchStripPrefix
And again S_FALSE was incorrectly used to indicate an error.
Fix this and be more compatible to the Windows 8 implementation of
this function:

- return E_INVALIDARG instead of S_FALSE if pszPath is NULL
- return E_INVALIDARG instead of S_FALSE if cchPath < 4
- return E_INVALIDARG if cchPath > PATHCCH_MAX_CCH
- allow stripping of "\\?\c:" and don't require "\\?\c:\"
- verify that the character at the drive letter position is
  actually an alphabetic character
- since the passed pszPath must not necessarily be null terminated
  and we always have enough space after the memmove we can always
  ensure the null termination of the stripped result

Also extended/fixed the TestPathCchStripPrefixctest
2015-06-03 16:06:02 +02:00
Norbert Federa
17ceafbb0c winpr: fix PathCchAddExtension
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE

Also extended/fixed the corresponding ctest
2015-06-03 16:06:02 +02:00
Norbert Federa
03b0472c29 winpr: fix PathCchAddBackslashEx
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE

Also extended/fixed the corresponding ctest
2015-06-03 16:06:02 +02:00
Norbert Federa
21e6012226 winpr: fix PathCchAddBackslash
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE

Also extended/fixed the corresponding ctest
2015-06-03 16:06:01 +02:00
Bernhard Miklautz
6b92fe3805 Merge pull request #2673 from nfedera/fix-hresult
winpr: fixed HRESULT & SCODE types, added a ctest
2015-06-03 10:05:09 +02:00
Norbert Federa
77769f10b6 winpr: fixed HRESULT & SCODE types, added a ctest
- HRESULT was unsigned which means that until now all usages of the
  SUCCEDED(hr) and FAILED(hr) macros never detected any errors
- Also fixed the (unused) SCODE typedef
- Added new ctest TestTypes
2015-06-02 19:52:52 +02:00
Armin Novak
c6c43d5f06 Writing failure to stderr. 2015-06-02 17:54:27 +02:00
Armin Novak
1c3b38f58b Fixed image test. 2015-06-02 17:53:16 +02:00
Armin Novak
2a3cd74c02 Fixed image test. 2015-06-02 15:17:54 +02:00
Armin Novak
e6283db1b9 Added missing NULL check. 2015-06-02 10:10:47 +02:00
Armin Novak
d3a88014da Fixed directory creation checks. 2015-06-02 10:01:10 +02:00
Armin Novak
70df8d8ba9 Fixed static function arguments. 2015-06-02 09:50:59 +02:00
Armin Novak
d1223d3799 Fixed windows known path locations. 2015-06-02 09:50:48 +02:00
David FORT
12f873f1f9 Fixed MessageQueue and callers 2015-05-29 14:24:14 +02:00
Hardening
4586450e27 Merge pull request #2661 from MartinHaimberger/mh-stream-fix
stream: check stream_new in winpr and libfreerdp
2015-05-29 14:12:59 +02:00
Martin Haimberger
951a2d2210 stream: check stream_new in winpr and libfreerdp
also fixed a few things
2015-05-29 04:46:50 -07:00