286 Commits

Author SHA1 Message Date
Peter Andersson ad902cadce Merge pull request #303 from Eun0us/fix/readdir-stack-buffer-overflow
fix: prevent stack buffer overflow in spiffs_read_dir_v()
2026-02-10 06:45:57 +01:00
Eun0us 54cf8d349e fix: prevent stack buffer overflow in spiffs_read_dir_v()
Replace unbounded strcpy with strncpy + explicit NUL termination when
copying the object name from flash into spiffs_dirent. The name field
read from raw flash may not be NUL-terminated, causing strcpy to read
past the end of the stack-allocated objix_hdr variable.

This matches the pattern already used in the write path (commit 8eb5cd3,
spiffs_nucleus.c:1018).

Fixes pellepl/spiffs#302
2026-02-10 01:39:19 +01:00
Peter Andersson 0b2e129011 Merge pull request #299 from pellepl/revert-297-master
Revert "Add CodeQL Workflow for Code Security Analysis"
2023-12-02 02:10:27 +01:00
Peter Andersson 0adcbcccba Revert "Add CodeQL Workflow for Code Security Analysis" 2023-12-02 02:10:00 +01:00
Peter Andersson 85feb63412 Merge pull request #297 from IVOES/master
Add CodeQL Workflow for Code Security Analysis
2023-11-29 23:13:10 +01:00
Brian 9521e104d7 Add CodeQL Workflow for Code Security Analysis
Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>
2023-10-20 14:34:41 -04:00
Brian 17abe84510 Add CodeQL Workflow for Code Security Analysis
Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>
2023-10-20 01:06:32 -04:00
Brian d082ea2881 Add CodeQL Workflow for Code Security Analysis
Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>
2023-10-18 17:01:15 -04:00
Brian 7ffe1dcc9c Add CodeQL Workflow for Code Security Analysis
Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every push and pull request to the main branch.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for third-party code, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation.

Signed-off-by: Brian <bayuan@purdue.edu>
2023-10-11 20:53:13 -04:00
Peter Andersson 0e3104cde5 fixes #292 2022-11-24 19:51:59 +01:00
Peter Andersson 0dbb3f71c5 Merge pull request #288 from igrr/bugfix/spiffs_readdir_errcode
fix SPIFFS_readdir setting errno to SPIFFS_VIS_END at the end of iteration
2022-06-01 19:13:30 +02:00
Ivan Grokhotkov 1239341b0d fix SPIFFS_readdir setting errno to SPIFFS_VIS_END
When iteration finishes, spiffs_obj_lu_find_entry_visitor returns
SPIFFS_VIS_END. Previously, SPIFFS_readdir function used to set
errno to this internal error value when readdir reached the end.
Handle this case and add a check into the regression test.
2022-06-01 12:03:32 +02:00
Peter Andersson 2b73a7fd31 Merge pull request #287 from vamshi51/feature/spiffs_ftruncate
Feature/spiffs ftruncate
2022-03-17 19:36:29 +01:00
gvk51 ada3ff9599 Add unit test to verify SPIFFS_ftruncate
resolve compilation warning for comparision b/w different data types
2022-03-17 23:40:25 +05:30
mikee47 6e1f29d98c Add SPIFFS_ftruncate function 2022-03-17 23:34:16 +05:30
Peter Andersson 22694c238f Merge pull request #279 from Hensoldt-Cyber/Fix_gcc_release_warnings
Fix strncpy truncating NUL terminating char
2021-05-17 21:44:59 +02:00
Carmelo Pintaudi 8eb5cd3662 Fix strncpy truncating NUL terminating char
This fix handles the gcc's `-Wstringop-truncation` warning.

See:
<https://stackoverflow.com/questions/50198319/gcc-8-wstringop-truncation-what-is-the-good-practice>
2021-05-17 10:15:26 +02:00
Peter Andersson 34c2447126 Merge pull request #277 from Hensoldt-Cyber/Fix_gcc_release_warnings
Fix gcc release warnings
2021-03-22 22:26:58 +01:00
Slawomir Kwasniak 514be7e23f Fix strncpy truncating NUL terminating char
This fix handles the gcc's `-Wstringop-truncation` warning.

See:
<https://stackoverflow.com/questions/50198319/gcc-8-wstringop-truncation-what-is-the-good-practice>
2021-03-22 21:14:25 +01:00
Slawomir Kwasniak a12142064c Fix uninitialized variables
More strict warnings are enforcing `total` and `used` to be initialized
as it seems that compiler is not happy with what `SPIFFS_info` does.
2021-03-22 21:11:17 +01:00
Peter Andersson 9d12e8f47b Merge pull request #271 from reiyawea/master
Update spiffs_nucleus.h
2020-08-24 08:05:22 +02:00
reiyawea 4d36fde5d4 Update spiffs_nucleus.h
Compiler warns "integer operation result is out of range" when spiffs_obj_id is typedef'ed to 32 bit. Rewrite 1 as 1UL solves the problem.
2020-08-23 21:09:55 +08:00
Peter Andersson a8bde1ddd9 Merge pull request #270 from samcaulfield-ubotica/master
Fix possible source of overflow in SPIFFS_check
2020-08-04 17:04:00 +02:00
Sam Caulfield 44e9260a3e Fix possible source of overflow in SPIFFS_check
pages_per_scan can overflow in some file system configurations. This
could occur for example in a file system where the logical page size is
32 KiB and the type of spiffs_page_ix is uint16_t.
2020-08-04 11:14:10 +01:00
Peter Andersson 8172b40813 Merge pull request #258 from MMI/master
Add ability to override the sizes of spiffs internal data types
2020-01-26 21:24:04 +01:00
Georg Nikodym 3cb24dbfd3 Add doc comment per pellepl review comment 2020-01-26 14:28:39 -05:00
Georg Nikodym d0d44c4908 Add ability to override the types of spiffs internal data 2020-01-26 13:17:50 -05:00
Peter Andersson 07e013056d Merge pull request #249 from svpcom/master
Add secure erase via zeroing page contents on deletion
2019-11-09 21:59:18 +01:00
Vasily Evseenko 554b59c147 Add secure erase via zeroing page contents on deletion 2019-11-08 19:39:29 +03:00
Peter Andersson f7d3e9f2b2 Merge pull request #244 from khalidjmi1200/master
Work around for cppcheck warning.
2019-09-10 13:58:11 +02:00
khalidjmi1200 f59d958e0b Work around for cppcheck warning.
cppcheck warning: Redundant assignment of 'fh' to itself.
2019-09-10 15:13:31 +09:00
Peter Andersson ec68ba8208 fixes #237
and a build warning
2019-04-04 21:19:19 +02:00
Peter Andersson 1350deb54c Merge pull request #173 from cesanta/flags
Be careful resetting flag bits
2017-10-15 18:57:54 +02:00
Peter Andersson 13935985cd 0.4.0 notice 2017-10-10 11:28:09 +02:00
Peter Andersson 8059e4c310 Merge pull request #174 from cesanta/ti_packed
TI compiler supports __attribute__((packed))
2017-10-10 11:21:45 +02:00
Peter Andersson 550903d3bf Merge pull request #168 from markrages/master
Python binding
2017-10-10 11:21:04 +02:00
Deomid Ryabkov da1cf49479 Be careful resetting flag bits
Only reset those that are set, do not assume that 0 -> 1 writes are ignored.

(hopefully) fixes https://github.com/pellepl/spiffs/issues/172
2017-10-08 16:00:27 +01:00
Deomid Ryabkov 20fc6df0ab TI compiler supports __attribute__((packed))
And compilation fails without it
2017-09-23 21:13:04 +01:00
Mark Rages 3a2faa8de1 API change: In Python, we don't need to pass around buffer sizes. 2017-09-14 11:38:24 -06:00
Mark Rages d65502a67a Test script for parameter detemination.
see https://github.com/pellepl/spiffs/issues/169
2017-09-14 11:37:46 -06:00
Mark Rages ffa9b73c84 Fix pointer-width bug with ctypes.
Avoid leaking memory (at least, if unmount is called).

Block-level test routines to see if read/write/erase are implemented properly.
2017-09-13 18:11:38 -06:00
Mark Rages 85556e8e5a Improved error handling in Python binding. 2017-09-12 15:17:17 -06:00
Mark Rages f9032882a0 Fix char-backed filesytem. 2017-09-11 22:13:21 -06:00
Mark Rages 96ea844ae4 Python bindings.
Mounts a filesystem backed by a filesystem file-like or a list-of-chars.  Individual files follow Python's file-like-object protocol.

Tested with Python 2.7.
2017-09-11 21:45:38 -06:00
Peter Andersson f5e26c4e93 fixes #165 2017-09-09 09:27:32 +02:00
Peter Andersson 3ebfeb5032 Merge pull request #164 from yinqiwu/master
Redefine __attribute__, solve the problem of compilation in IAR envir…
2017-09-08 14:45:29 +02:00
bruce 7e96ab1ee8 Redefine __attribute__, solve the problem of compilation in IAR environment but 2017-08-29 16:19:39 +08:00
Peter Andersson 794f0478d2 probably fixes #152 SPIFFS_remove() doesn't free file descriptor 2017-08-04 18:54:06 +02:00
Peter Andersson c57c386f8a fixes #159 2017-07-27 19:37:28 +02:00
Peter Andersson 287148c465 0.3.7 documenting 0.3.7 2017-07-17 09:45:16 +02:00