Commit Graph

89 Commits

Author SHA1 Message Date
akallabeth
b894199f72 [winpr,collections] add generic string clone functions
The ArrayList, HashTable, ... New functions require
void* (*fkt)(const void* ptr) type functions. Provide a generic wrapper
for CHAR and WCHAR strdup to eliminate warnings. Also export a
corresponding free function to avoid issues with runtime
differences.
2024-02-15 11:49:16 +01:00
akallabeth
0e44b2c674 [clang-tidy] clang-analyzer-unix.Malloc 2024-02-15 11:49:16 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
akallabeth
ba8cf8cf21 [build] fix Wmismatched-deallocator warnings
With custom malloc function attributes the fail path in the _New
functions produces warnings due to allocator mismatches. Silence them.
2024-02-05 08:16:55 +01:00
akallabeth
c2f4ad80a5 [common,settings] fix TargetNetAddresses usage
* use a common function to allocate both, TargetNetAddresses and
  TargetNetPorts
* unify handling, utilize helper functions as much as possible
2024-01-09 15:18:37 +01:00
akallabeth
fbc25978ae [common,assist] fix file parser (Fixes #9726)
* only append N or U entry if it was found
* append port for N and U entries
2024-01-04 10:50:12 +01:00
akallabeth
dd2d110870 [warnings] fix -Wcast-qual 2023-11-24 18:19:03 +01:00
akallabeth
4fb7035242 [common,assistance] fix shadowed variable 2023-06-29 18:34:51 +02:00
akallabeth
1fc0d5b4b1 [winpr] remove casts for winpr_RAND calls 2023-06-21 09:57:52 +02:00
Armin Novak
e264512220 [common,assistance] fix missing NULL check 2023-06-19 09:24:18 +02:00
akallabeth
18df3176e1 [common,assistance] fix assistance file parser
* ensure a valid delimiter is following the token searched for
* add a test case to ensure this works
2023-06-16 09:14:10 +02:00
Armin Novak
010e1252c4 [common,assistance] fix NULL argument for strstr 2023-06-14 13:50:59 +02:00
akallabeth
89bbed83db [common,assistance] clean up assistance file parser 2023-06-13 10:03:57 +02:00
Sergey Bronnikov
d8254c5ff3 [libfreerdp] Fix msan's use-of-uninitialized-value
Uninitialized bytes in __interceptor_strlen at offset 0 inside [0x701000000040, 1)
==220==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x535c13 in freerdp_assistance_hex_string_to_bin /src/FreeRDP/libfreerdp/common/assistance.c:711:11
    #1 0x533deb in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/common/test/TestFuzzCommonAssistanceHexStringToBin.c:5:15
    #2 0x43f5f3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #3 0x4409a4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:804:3
    #4 0x440e79 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
    #5 0x4304df in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #6 0x459b32 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #7 0x7effc08bb082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #8 0x420f1d in _start (/tmp/not-out/tmpu5o6go0a/TestFuzzCommonAssistanceHexStringToBin+0x420f1d)
2023-06-07 14:25:57 +02:00
akallabeth
5799fb2018 Replace ConvertFromUnicode and ConvertToUnicode
* Use new ConvertUtf8ToWChar, ConvertUtf8NToWChar,
  ConvertUtf8ToWCharAlloc and ConvertUtf8NToWCharAlloc
* Use new ConvertWCharToUtf8, ConvertWCharNToUtf8,
  ConvertWCharToUtf8Alloc and ConvertWCharNToUtf8Alloc
* Use new Stream UTF16 to/from UTF8 read/write functions
* Use new settings UTF16 to/from UTF8 read/write functions
2022-11-28 10:42:36 +01:00
akallabeth
43c5289928 Replaced memset/ZeroMemory with initializer
* Addes WINPR_ASSERT on many occations
* Replaced memset with array initializer
* Replaced ZeroMemory with array initializer
2022-10-14 12:11:01 +02:00
garbb
fff93f62ed
fix freerdp_assistance_parse_address_list parsing (#8147)
* fix remote assistance connection string1 parsing 

Fails to parse when connection string only has one host:port because there is no ";" character. Also when multiple host:port;host:port it skip first host:port and parses remaining host:port as ";host:port...end" of connection string:
eg:
;192.168.93.138:49626;192.168.93.139:49627;192.168.93.140:49628
;192.168.93.139:49627;192.168.93.140:49628
;192.168.93.140:49628

* Update assistance.c

* Update assistance.c

* Update assistance.c
2022-09-09 09:27:52 +02:00
garbb
6b62ce9200
unescape &amp; in PassStub (#8183)
* unescape &amp; in PassStub

windows sometimes creates .msrcincident file with escaped ampersand as `&amp;` in PassStub. Need to unescape or server will deny connection and complain about incorrect password.

* Update assistance.c
2022-09-08 09:52:36 +02:00
garbb
078fc50102 Update assistance.c
Minimum valid IP address is x.x.x.x (length 7)?
2022-09-07 11:01:09 +02:00
akallabeth
3d9c972d5c
Replace direct rdpSettings access with getter/setter (#7867)
* Replace direct rdpSettings access with getter/setter

* Fixed xf_gdi_update_screen const warning
2022-05-02 10:55:44 +02:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
Armin Novak
5fb59a23a9 Fixed lots of compilation warnings and type mismatches 2021-06-16 15:21:56 +02:00
akallabeth
6b36c6d417
Replace fopen and path functions with wrappers (#7043)
Functions like fopen, PathFileExists, PathMakePath need to call
the wide character versions on windows for utf-8 support.
2021-05-31 11:42:03 +02:00
Ondrej Holy
892cbe3261 Fix various memory leaks reported by Coverity
Covscan report contains various memory leak defects which were marked
as important. I have spent some time analyzing them and although they
were marked as important, most of them are in error cases, so probably
nothing serious. Let's fix most of them anyway. The rest are false
positives, or too complicated to fix, or already fixed in master, or
simply I am unsure about them.

Relates: https://github.com/FreeRDP/FreeRDP/issues/6981
2021-04-27 14:25:20 +02:00
akallabeth
2ea7ac0c06 Unified bin to hex and hex to bin conversion
* Added new functions in WinPR
* Added unit tests for new functions
* Replaced existing (internal) conversion functions
2021-04-19 10:45:21 +02:00
odednoam
88102275f0
Bugfix: when freerdp_assistance_parse_file_buffer was called from external code, it did not copy the access password to the rdpAssistanceFile struct. (#6550)
* Fixed bug with assistance buffer parsing: `freerdp_assistance_parse_file_buffer` may be called directly, not necessarily from `freerdp_assistance_parse_file`, so password should be saved to the `rdpAssistanceFile` in `freerdp_assistance_parse_file_buffer`.
2020-11-09 09:19:53 +01:00
Armin Novak
44cf91be37 Fixed #6245: Added additional tests to assistance parser 2020-06-02 13:36:03 +02:00
Armin Novak
9c999b7135 Added raw function wrapping X509_digest 2020-03-06 11:37:35 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
asapelkin
82eadad4a4 Fix some static analizer warnings 2019-10-22 15:39:54 +02:00
Armin Novak
4d4e7a69d7 Fixed remaining getter/setter return checks. 2019-05-09 14:04:40 +02:00
Armin Novak
93bf375686 Refactored settings getter/setter to stay compatible. 2019-05-08 14:35:25 +02:00
Armin Novak
6ac91924d5 Fixed use of settings getter/setter 2019-05-08 14:17:23 +02:00
Armin Novak
49936a7ba6 Fixed #5276: Enable SSL before parsing assistance file.
The assistance file requires primitives from the ssl wrapper.
Enable these before parsing the file.
Additionally split the FIPS mode enablement from the one time
initializer to avoid ignoring that flag.
2019-02-25 10:37:30 +01:00
Martin Fleisz
6415cfec48
Merge pull request #5131 from akallabeth/cmd_line_error_logging
Added extended error logging for assistance, rdp file and command line parser
2019-02-08 09:11:35 +01:00
Armin Novak
9d680904cc Fixed compiler warnings #5210 2019-01-29 16:14:55 +01:00
Armin Novak
08cc3cdee4 Fixed use after free. 2019-01-16 15:00:13 +01:00
Armin Novak
89f3f7d837 Added extended error logging for assistance, rdp file and command line parser. 2019-01-16 14:32:19 +01:00
Joachim Meyer
c8358fdda6 Reject assistance input if not a RA invitation or connection string 2. 2019-01-07 13:00:48 +01:00
Joachim Meyer
7efbae282c Set the username setting again, if it exists. 2019-01-07 10:38:55 +01:00
Joachim Meyer
8d50c4ce2d Add support for standard Remote Assistance Connection String 2 without the extensions of the invitation file format. 2019-01-03 20:58:40 +01:00
Armin Novak
7ba34962e6 Removed duplcate NULL checks. 2018-11-22 11:21:57 +01:00
Armin Novak
f904d84638 Fixed freerdp_assistance_parse_address_list
* Return a proper error in case parsing fails.
* Don't duplicate string as we already operate on a duplicate.
2018-11-22 11:17:13 +01:00
Armin Novak
59e9abc737 Fixed memory leak in reallocate. 2018-11-22 11:11:31 +01:00
Armin Novak
c8908c8be6 Updated windows shadow server assistance usage. 2018-11-22 11:11:31 +01:00
Armin Novak
484ceaed34 Fixed assistance unit test. 2018-11-22 11:11:31 +01:00
Armin Novak
e1555662d1 Set username from assistance file. 2018-11-22 11:11:31 +01:00
Armin Novak
35c1eac6ec Unified address parsing for assistance files. 2018-11-22 11:11:31 +01:00