Commit Graph

14 Commits

Author SHA1 Message Date
Jonathan Senkerik f445e80930 Merge branch 'fixes'
Fixes recommended by maintainer.

1. Buffer Overflow in FUSE Options Parsing (pfs.c)
  - Fixed

2. Base64 Padding Bug (putil.c)
  - I believe the padding logic at lines 273-284 is not a bug - it's correct per RFC 4648 base64 specification. Padding is only added when length != 0
   (i.e., when there's a partial final block), and the correct number of "=" characters are added based on whether 1 or 2 bytes remain.

3. Memory Leaks in pdiff.c
  - Fixed

4. Race Condition in Log Rotation (pdbg.c)
  - I believe the code is actually already correct.

  - The code at line 20 already uses volatile sig_atomic_t:

  static volatile sig_atomic_t log_reopen_requested = 0;

  This is the correct and safe pattern for signal handler communication:

  1. sig_atomic_t - Guarantees atomic read/write operations (no partial updates)
  2. volatile - Prevents the compiler from optimizing away accesses

  The pattern is correct:
  - Signal handler (pdbg_reopen_log at line 178-180) only sets the flag - async-signal-safe
  - Main code checks/resets the flag inside pthread_mutex_lock() (lines 133-136, 231-234)
  - Actual log reopening (do_reopen_log) happens in the main thread, not signal context

  This is a well-established and safe pattern. The mutex ensures the check-and-reset is serialized with other logging, and sig_atomic_t
  ensures the signal-to-main-thread communication is atomic.

5. Hardcoded RSA Padding (pssl.c)
  - Fixed

6. Unchecked Exception (pclsync_lib.cpp)
  - Fixed

7. Missing Input Validation
  - Fixed

Issue #1: Double Logging and Memory Leak in `process_deletefile()`
  - Fixed duplicate log.
  - Note: There was no actual memory leak - the first path allocation at line 1731 was properly freed at line 1735 before the second
  allocation at line 1739.

Issue #2: FUSE Options Parsing Problems
  - Fixed
2026-02-18 22:08:15 -05:00
Jonathan Senkerik 00ce50dee6 Add support for account login by env vars 2026-02-18 22:02:49 -05:00
Jonathan Senkerik 6d050926ee fixes for MR 2026-02-17 23:06:35 -05:00
Jonathan Senkerik ead9dfe572 update documenation, add FUSE options 2025-11-23 22:39:18 -05:00
Jonathan Senkerik cb68942340 Refactor logging, add cache-size, fs-event-log 2025-11-14 23:11:47 -05:00
Levi Neely 79141898c3
84 security enhancements (#133)
- DoD 5220.22-M compliant memory wipe replaces single-pass zero wipe
- Wipe in-memory request and response messages before freeing
- Wipe in-memory private keys and salt data before freeing
- Wipe all passwords on unlink / logout
- Wipe crypto password on all pcryptofolder_unlock return paths
2025-03-11 15:05:43 +01:00
Levi Neely 43521f603c
resolve cmd ambiguity, just support pipe input (#124) 2025-03-09 19:25:34 +01:00
Levi Neely 27977765e8
non interactive command processing (#123)
* support non-interactive command processing
- app is now configured in setup_app function
- added process_command() to api
- support piped input and -c argument
- fix memleaks
2025-03-09 19:18:38 +01:00
FloFri 5a5dec975f
Add basic 2FA (code from https://github.com/pcloudcom/console-client/pull/163) (#86)
Co-authored-by: Florian Friedrich <friedrich@procster.de>
2025-01-12 17:34:39 +01:00
Levi Neely c687484707
Implement add, remove, and list sync folder commands (#59)
* list_sync_folders seems to work

* list_sync_folders breaks with sync folders in db; message size problem?

* fixed sync folders list

* fix double free and buffer overflow

* wip: add and remove sync folder; need to fix request->value in instance_thread

* remove comment

* removed pclsync_lib_c.{h,cpp}

* cleanup get_answer_to_request

* update comment

* changed reply struct to type response containing payload and msg

* cleanup

* refactored overlay_client, and poverlay; added docs

* better naming

* sock path in poverlay_protocol.h

* clarify comment

* refactor psync_overlay_get_response

* clarifications

* response_messages work with and without payload

* removed commented code

* syncadd works, but i need to fix the error handling

* remove sync folder

* remove commented code, change printfs to debug or simply remove

* removed unnecessary print

* removed more prints

* removed dead var

* update error handling in add_sync_folder, fix memleak

* simplified finalize
2024-08-25 21:54:41 +02:00
Levi Neely ed06599b7d
Bug fixes, build containers, minor updates (#54)
* openssl is a dependency

* openssl is not a real dpendency

* static link by default

* wip: build containers

* rm comments

* build containers, fix DEADLYSIGNAL on run with no args

* debug tools in deb/ubuntu, fix #44

* no slack container :(

* ensure P_LINUX_OS always defined

* error check fuse unmount ops

* fsanitize=thread temporarily

* undo

* clang static analysis

* fix dead assignment

* makefile quality of life stuff

* make install and uninstall; ignore scan results

* addressed dead assignments from static analysis

* debug and release builds possible

* gcc still default compiler

* debug symbols on debug build only
2024-08-20 22:00:38 +02:00
Levi Neely bec97722cd
reorg source tree, link system mbedtls (#38)
* reorg source tree, link system mbedtls

* remove cmakelists.txt

* update ci workflow

* -Werror to -Wall

* libpcloudcc_so in makefile

* single makefile works

* removed extra makefiles
2024-08-15 19:49:57 +02:00
Levi Neely 7801d1af76 more reorganization 2024-06-27 22:32:13 +02:00
Levi Neely 2a01c043ff simplified directory structure 2024-06-27 22:05:44 +02:00