pcloudcc-lneely/pclsync
Levi Neely 60e43edec4
Fix pcl-a1j: buffer overflow in ptools_create_backend_event() via unchecked sprintf and strcat (#355)
* Fix pcl-a1j.1: replace sprintf with snprintf and add strcat length check in ptools_create_backend_event()

Add paramname length check (> 254 bytes → skip with warning) before
snprintf into charBuff[i][258], and validate the snprintf return
value. Add explicit length check before strcat into keyParams to
prevent overflow when paramname exceeds remaining buffer space.
Eliminates buffer overflow from long paramname.

Ref GH #195.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix pcl-a1j.1: clamp pCnt to PTOOLS_MAX_PARAMS to prevent charBuff stack overflow

charBuff[30][258] is a fixed-size stack array but pCnt was unbounded,
allowing any caller with params->paramCnt > 30 to overflow the stack
via charBuff[i] access. Add PTOOLS_MAX_PARAMS (30) define, use it to
size charBuff, and clamp pCnt to PTOOLS_MAX_PARAMS with a warning log
before the loop.

Ref GH #195.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add ptools_create_backend_event() validation tests (pcl-a1j)

11 test cases covering pCnt clamping, paramname length guards,
snprintf boundary, keyParams overflow check, and comma-prefix
for subsequent params.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 18:35:43 +01:00
..
debug Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
LICENSE reorg source tree, link system mbedtls (#38) 2024-08-15 19:49:57 +02:00
paccountevents.h reorg source tree, link system mbedtls (#38) 2024-08-15 19:49:57 +02:00
papi.c Fix pcl-zqv.4.2: protocol parsing and buffer safety in prpc/papi (#348) 2026-03-04 19:02:01 +01:00
papi.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pbusinessaccount.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pbusinessaccount.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pcache.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pcache.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pcommands.h Fix #90, #109: Support 2FA when running as a daemon (#175) 2026-03-02 21:36:33 +01:00
pcompiler.h Code cleanup and readline for better CLI UX (#116) 2025-03-09 09:14:12 +01:00
pcontacts.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pcontacts.h reorg source tree, link system mbedtls (#38) 2024-08-15 19:49:57 +02:00
pcrc32c.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pcrc32c.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pcrypto.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pcrypto.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pcryptofolder.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pcryptofolder.h access pcryptofolder directly from pclsync_lib (#125) 2025-03-09 19:58:00 +01:00
pdatabase.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
pdbg.c Fix pcl-0c1: make pdbg_runtime_level atomic (#343) 2026-03-03 20:08:18 +01:00
pdbg.h Fix pcl-0c1: make pdbg_runtime_level atomic (#343) 2026-03-03 20:08:18 +01:00
pdeflate.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pdeflate.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pdevice.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pdevice.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
pdevmon.c fix compile errors (#155) 2025-05-15 19:14:57 +02:00
pdevmon.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pdiff.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pdiff.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pdownload.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pdownload.h Code cleanup and readline for better CLI UX (#116) 2025-03-09 09:14:12 +01:00
pfile.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfile.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
pfileops.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pfileops.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pfolder.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfoldersync.h move folder-related code from psynclib to pfolder 2025-04-18 15:23:50 +02:00
pfs.c Fix pcl-3la: pstatus saturating add and fuse thread cleanup (#352) 2026-03-07 16:24:53 +01:00
pfs.h Fix signal handler safety issues (pcl-2tv) (#351) 2026-03-06 21:34:00 +01:00
pfs_internal.h Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfscrypto.c Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfscrypto.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsfolder.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsfolder.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsstatic.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsstatic.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfstasks.c Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfstasks.h Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfstasks_internal.h Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfsupload.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsupload.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pfsxattr.c Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pfsxattr.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pintervaltree.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pintervaltree.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
plibs.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
plibs.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
plist.c Add integer overflow checks in psync_list_builder_finalize() (#318) 2026-03-03 15:27:07 +01:00
plist.h Fix typo: rename psync_list_bulder_* to psync_list_builder_* (#302) 2026-03-03 12:23:16 +01:00
plocalnotify.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
plocalnotify.h Code cleanup and readline for better CLI UX (#116) 2025-03-09 09:14:12 +01:00
plocalscan.c Fix pcl-96f: make psync_current_time accesses atomic (#345) 2026-03-04 18:14:33 +01:00
plocalscan.h Code cleanup and readline for better CLI UX (#116) 2025-03-09 09:14:12 +01:00
plocks.c 98 create a pdbg namespace (#139) 2025-03-13 20:28:09 +01:00
plocks.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pmem.c Remove legacy Unix fallbacks from pmem.c (#312) 2026-03-03 14:55:20 +01:00
pmem.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
pnetlibs.c Fix pcl-96f: make psync_current_time accesses atomic (#345) 2026-03-04 18:14:33 +01:00
pnetlibs.h 98 create a pdbg namespace (#139) 2025-03-13 20:28:09 +01:00
pnotify.c Fix typo: rename psync_list_bulder_* to psync_list_builder_* (#302) 2026-03-03 12:23:16 +01:00
pnotify.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pp2p.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pp2p.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
ppagecache.c Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
ppagecache.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
ppassword.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
ppassword.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
ppassworddict.h reorg source tree, link system mbedtls (#38) 2024-08-15 19:49:57 +02:00
ppath.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
ppath.h Musl fixes (#143) 2025-04-13 09:11:11 +02:00
ppathstatus.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
ppathstatus.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pqevent.c Fix pcl-g46: make psync_status queue fields atomic in status_change_thread (#347) 2026-03-04 18:36:12 +01:00
pqevent.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
prand.c Fix data race on lastseed in prand_seed() (#330) 2026-03-03 16:43:59 +01:00
prand.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
prpc.c Fix pcl-zqv.4.2: protocol parsing and buffer safety in prpc/papi (#348) 2026-03-04 19:02:01 +01:00
prpc.h 130 use trustworthy location for log and socket (#134) 2025-03-11 19:03:58 +01:00
prun.c Fix pthread_create return unchecked in prun.c (#300) 2026-03-03 12:16:30 +01:00
prun.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
prunthrottled.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
prunthrottled.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pscanexts.h Appease the LSP server (#73) 2024-11-26 19:36:49 +01:00
psettings.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
psettings.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
pshm.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
pshm.h #64 simplify messaging and #71 deserialize failed (#88) 2025-02-25 09:46:46 +01:00
psock.c Fix pcl-zqv.4.3: socket lifecycle and fd management in psock.c (#349) 2026-03-04 19:13:18 +01:00
psock.h eliminate pcompat (#92) 2025-02-28 22:47:32 +01:00
psql.c Fix typo: rename psync_list_bulder_* to psync_list_builder_* (#302) 2026-03-03 12:23:16 +01:00
psql.h 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
psql_internal.h Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
pssl.c Fix pcl-zqv.4.12: add bounds check in trim_der_key (#341) 2026-03-03 19:53:01 +01:00
pssl.h 98 create a pdbg namespace (#139) 2025-03-13 20:28:09 +01:00
psslcerts.h Add new pCloud SSL certificate fingerprint (#172) 2026-03-01 09:14:29 +01:00
pstatus.c Fix pcl-3la: pstatus saturating add and fuse thread cleanup (#352) 2026-03-07 16:24:53 +01:00
pstatus.h Code cleanup and readline for better CLI UX (#116) 2025-03-09 09:14:12 +01:00
psuggest.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
psuggest.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
psyncer.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
psynclib.c Fix pcl-96f: make psync_current_time accesses atomic (#345) 2026-03-04 18:14:33 +01:00
psynclib.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
psys.c Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
psys.h Fix debug build segfault: add strong overrides for psql_lock/unlock functions (#177) 2026-03-03 07:59:30 +01:00
ptask.c Fix data race on task refcount in psync_task_free (#344) 2026-03-03 21:15:57 +01:00
ptask.h 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
ptevent.c Fix ptevent: memory leak, NULL-deref, and race condition (#316) 2026-03-03 15:15:22 +01:00
ptevent.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
ptimer.c Fix pcl-96f: make psync_current_time accesses atomic (#345) 2026-03-04 18:14:33 +01:00
ptimer.h 98 create a pdbg namespace (#139) 2025-03-13 20:28:09 +01:00
ptools.c Fix pcl-a1j: buffer overflow in ptools_create_backend_event() via unchecked sprintf and strcat (#355) 2026-03-07 18:35:43 +01:00
ptools.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
ptree.c 102 create a psql namespace (#142) 2025-03-18 19:52:15 +01:00
ptree.h Fix ptree_for_each_element loop termination condition (#319) 2026-03-03 15:29:44 +01:00
ptypes.h Appease the LSP server (#73) 2024-11-26 19:36:49 +01:00
publiclinks.c Fix typo: rename psync_list_bulder_* to psync_list_builder_* (#302) 2026-03-03 12:23:16 +01:00
publiclinks.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
pupload.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
pupload.h WIP: Decompose namespaces and other cleanup (#94) 2025-03-01 22:21:54 +01:00
putil.c Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
putil.h Increase maintainability: namespace refactors for putil, pfs, and pfs sub-modules (#176) 2026-03-02 22:51:25 +01:00
sockets.h Merge pclsync and poverlay_linux (#46) 2024-08-18 15:09:21 +02:00