Commit graph

9 commits

Author SHA1 Message Date
Nightt
a74b2fc61b system/settings: Bound public string handling
Use strnlen() for public key, value, and storage path length checks so user-provided settings strings are validated against the configured maximum sizes before they are scanned.

Use bounded key comparisons and strlcpy() for fixed-size settings fields. This addresses part of #3109 without changing the settings API or storage formats.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-28 14:35:54 +02:00
Nightt
0dd221cc76 system/settings: Drop unused recursive mutex type
The settings save path no longer re-enters g_settings.mtx, so the mutex does not need to be initialized as PTHREAD_MUTEX_RECURSIVE.

This keeps the #3105 fix independent of CONFIG_PTHREAD_MUTEX_TYPES and destroys the temporary mutex attribute object after initialization.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-25 14:36:36 +02:00
Nightt
2d949fa7c5 system/settings: Avoid recursive save locking
Fix #3105 by making the immediate save path write pending settings while the caller still owns g_settings.mtx instead of calling the timer callback, which locks the same mutex again.

The cached-save timer callback still takes the mutex before using the same locked helper, so asynchronous saves keep their existing synchronization while non-cached saves no longer depend on a recursive mutex.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-25 14:36:36 +02:00
Jean THOMAS
c7b395e7da system/settings: Add spaces after each switch 'case' 2025-06-26 13:22:47 -03:00
Jean THOMAS
4be82876e4 system/settings: general code cleaning
* Remove duplicate checks, use switch/case whenever possible
* Remove assertions just before if () condition checking the exact
  same thing
* Replace if (condition) assert(0) with assert(condition)

Signed-off-by: Jean THOMAS <jean@lambdaconcept.com>
2025-06-26 13:22:47 -03:00
Jean THOMAS
bb508520f1 system/settings: fix assertion triggered by uninitialized variables
Fix non-NULL pointer assertion in `get_setting()` caused by
uninitialized pointer variables.

Signed-off-by: Jean THOMAS <jean@lambdaconcept.com>
2025-06-26 19:23:02 +08:00
Alin Jerpelea
66e8296230 system: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-30 18:02:50 +08:00
Tim Hardisty
4ebd68f7d8 Update settings.c 2024-08-30 21:29:50 +08:00
TimJTi
169beaeef7 Add Settings Utility and example app 2024-03-03 02:36:56 +08:00