Commit Graph

117 Commits

Author SHA1 Message Date
lilei19
41f60bd669 change strcpy to strlcpy
Change-Id: I8b9429a3c225a82842fce136bdb14b8b135066d3
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-22 23:09:55 +08:00
Junbo Zheng
78b7318a04 fsutils/passwd: fix warning: leak of ‘iobuffer’ [CWE-401] [-Wanalyzer-malloc-leak]
In function ‘passwd_find’:
passwd_find.c:82:14: warning: leak of ‘iobuffer’ [CWE-401] [-Wanalyzer-malloc-leak]
   82 |       return -errcode;
      |              ^~~~~~~~
  ‘passwd_find’: events 1-5
    |
    |   65 |   iobuffer = (FAR char *)malloc(CONFIG_FSUTILS_PASSWD_IOBUFFER_SIZE);
    |      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                          |
    |      |                          (1) allocated here
    |   66 |   if (iobuffer == NULL)
    |      |      ~
    |      |      |
    |      |      (2) assuming ‘iobuffer’ is non-NULL
    |      |      (3) following ‘false’ branch (when ‘iobuffer’ is non-NULL)...
    |......
    |   73 |   stream = fopen(CONFIG_FSUTILS_PASSWD_PATH, "r");
    |      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |            |
    |      |            (4) ...to here
    |   74 |   if (stream == NULL)
    |      |      ~
    |      |      |
    |      |      (5) following ‘true’ branch (when ‘stream’ is NULL)...
    |
  ‘passwd_find’: event 6
    |
    |   80 |       int errcode = errno;
    |      |                     ^~~~~
    |      |                     |
    |      |                     (6) ...to here
    |
  ‘passwd_find’: event 7
    |
    |   82 |       return -errcode;
    |      |              ^~~~~~~~
    |      |              |
    |      |              (7) ‘iobuffer’ leaks here; was allocated at (1)
    |

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-02-18 17:24:54 +08:00
Xiang Xiao
a29d9ea9da fsutils/examples: Include unistd.h explicitly
to get the prototypes or macros are defined in it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-05 08:46:59 +02:00
Xiang Xiao
b659f0fbdf Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 18:40:23 +02:00
Xiang Xiao
4941182cc6 Make.defs: Change "ifeq ($(XXX),y)" to "ifneq ($(XXX),)
to support the tristate option correctly and unify the usage

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 14:59:08 +02:00
Fotis Panagiotopoulos
0cdb2cfa48 Fixed compiler warnings. 2022-08-23 01:39:59 +08:00
weizihan
c4972d4721 apps: Fix bug by calling getrandom
Signed-off-by: weizihan <weizihan@xiaomi.com>
2022-08-18 18:02:01 +08:00
Xiang Xiao
b515a00fea zmodem: Move crc16.h and crc32.h from host to host/nuttx
to avoid the conflict with the 3rd party library

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-13 13:28:30 +03:00
Jiuzhu Dong
c0cafab1a7 fsutils/mkfatfs: remove invalid header file
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-08 00:55:49 +08:00
Peter van der Perk
a0d0f5eb25 mkfats make g_bootcodeblob const to save on static ram usage 2022-08-02 21:05:05 +08:00
Petro Karashchenko
d868387148 fsutils/passwd: fix out of bounds array access during password encryption
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 22:11:01 +08:00
Petro Karashchenko
cfadf7b9dc fsutils/passwd: fix compilation
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-25 11:07:10 +02:00
Fotis Panagiotopoulos
bc5d8034f1 Typo fixes. 2022-01-06 10:30:41 +08:00
Eero Nurkkala
ced74a064d fsutils/ipcfg: fix debugassert
cppcheck reports the following error:

fsutils/ipcfg/ipcfg_binary.c:332:15: error: Uninitialized variable: fd [uninitvar]
  DEBUGASSERT(fd >= 0 && ipv6cfg != NULL);

Update the DEBUGASSERT() to match that of ipcfg_read_binary_ipv4(). fd is
uninitilized and doesn't need to be checked here.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2021-12-27 20:42:48 -06:00
David Sidrane
4e9921c9b2 fsutils/mkfatfs:Allow for configurable buffer alignment 2021-11-22 20:54:21 -06:00
Jiuzhu Dong
f5e40d3809 fsutils/mkgpt: support gpt partition format
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-28 08:54:30 +02:00
Jiuzhu Dong
aaf6f5c4cb fsutils/mkmbr: support mbr partition format
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-28 08:54:30 +02:00
Juha Niskanen
c6436bfdbb fsutils/mksmartfs: fix confusing ioctl return value with errno value
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-08-11 10:38:00 -03:00
Xiang Xiao
8ba32a8c16 Fix the printf warning after blkcnt_t change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-22 04:44:16 -07:00
Alin Jerpelea
f73cc8cda7 Author: Michal Lyszczek: update licenses to Apache
Gregory Nutt is has submitted the SGA

Michal Lyszczek has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 05:05:27 -05:00
David Sidrane
3f2db83898 fsutils/ipcfg: Add assert header 2021-06-08 13:19:50 -05:00
Alin Jerpelea
f99a4f557d fsutils: update licenses to Apache
Gregory Nutt is has submitted the SGA
Ken Pettit has submitted the ICLA

 as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-08 08:43:15 -05:00
Alin Jerpelea
1e88c73107 Makefile: Ken Pettit: update licenses to Apache
Gregory Nutt is has submitted the SGA

Ken Pettit has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Alin Jerpelea
ec339bc49a Makefiles: Gregory Nutt: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Xiang Xiao
1ee948e0c8 Include assert.h for DEBUGASSERT caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:34:37 +09:00
Abdelatif Guettouche
3fc062e9cd fsutils/mkfatfs/Kconfig: Select BCH
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-03-23 23:53:03 -07:00
Gustavo Henrique Nihei
08f1dd0093 fsutils/mksmartfs: Fix regression caused by BCH separation 2021-03-19 23:11:44 -07:00
Byron Ellacott
2e17cd2e6b fsutils: update geometry size (c.f. apache/incubator-nuttx#2861) 2021-02-18 20:38:56 -08:00
Huang Qi
3040c59ae9 Replace all wget with curl
wget is missing from some system (like macOS and Windows native),
it's better to use curl to simplify build environment.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-21 22:45:46 -06:00
YAMAMOTO Takashi
e9a48d174e fsutils/mkfatfs/configfat.c: Fix syslog formats 2020-12-01 07:45:05 +01:00
YAMAMOTO Takashi
89ada765d3 fsutils/mkfatfs/mkfatfs.c: Fix a syslog format 2020-11-21 18:46:07 -08:00
YAMAMOTO Takashi
e4584b00d6 fsutils/mkfatfs/writefat.c: Fix syslog formats 2020-11-20 07:29:43 -08:00
YAMAMOTO Takashi
807fab7836 fsutils/mkfatfs/writefat.c: Appease nxstyle 2020-11-20 07:29:43 -08:00
YAMAMOTO Takashi
2c0c033b43 fsutils/mkfatfs/configfat.c: Fix syslog formats 2020-11-20 07:29:43 -08:00
YAMAMOTO Takashi
b92526ab2b fsutils/mkfatfs/configfat.c: Appease nxstyle 2020-11-20 07:29:43 -08:00
YAMAMOTO Takashi
2319502ea3 fsutils/mkfatfs/mkfatfs.c: Fix syslog formats 2020-11-20 07:29:43 -08:00
David Sidrane
9f9fed3232 ipcfg_binary: Fix compiler warning 2020-10-16 10:11:21 +08:00
Gregory Nutt
f65b16bb2e Incorporate IP configuration files into netinit.
Uses logic from apps/fsutils/ipcfg to obtain the IP address configuration from a file, if available.  This only effects the behavior of netinit if CONFIG_FSUTILS_IPCFG is selected and if an IP configuration file is available on a file system. Otherwise, it reverts to the preceding behavior.

Also adds definitions to apps/include/fsutils/ipcfg.h to formalize a bit encoding of the prototype which was already in use, but not documented.

Also fixes some bad assertions (duplication of PR #420) and makes use of variable names consistent in ipcfg.h comments and in ipcfg_text implementation.
2020-10-06 10:42:35 -07:00
David Sidrane
833d231031 ipcfg:Version the binary structure 2020-10-06 08:20:26 -06:00
Gregory Nutt
a627561c8f apps/fsutils/ipcfg: Add support for IPv6 2020-10-05 00:07:05 +08:00
Gregory Nutt
707e827ded ipcfg: Add hooks for future IPv6 support.
This commit adds structures, modifies function prototypes, and renames data to support the future addition of IPv6 support.  This commit does NOT add that IPv6, only the hooks for backward compatible future support.
2020-10-02 12:30:47 -07:00
David Sidrane
ff866b9527 fsutils:ipcfg Fix fd propagation as return value in bin mode
With CONFIG_IPCFG_BINARY lit. ipcfg_open needs to return
   the fd or an -errno. It was returning OK not the fd.
2020-09-30 14:09:18 -06:00
David Sidrane
17c34df3b9 fsutils:ipcfg Fix range checking for PRTOCOL in bin mode 2020-09-30 14:09:18 -06:00
Gregory Nutt
5e1ba408b4 Add IPv4 Configuration File Access Helper
This commit adds support to access an IPv4 Configuration file similar to the Linux dhpc.client ipfcg file.  This version, tailored for deeply embedded systems supports several options to tailor the file and file access to different environments.  It supports:

- Writable as well as read-only configuration files.
- ASCII human readable files as well as smaller binary files.
- It supports using character driver access to constrained media (such as EEPROM).
- Add examples/ipcfg to exercise IPv4 Configuration File support
2020-09-29 12:24:07 -07:00
Xiang Xiao
e6c5ff9208 Remove the unnecessary touch and clean from Makefile
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-11 19:10:19 +01:00
Maciej Wójcik
21049ece6e Rewritten READMEs to Markdown 2020-07-25 01:01:51 -07:00
Maciej Wójcik
51e6645f71 Rename README and README.txt to README.md 2020-07-25 01:01:51 -07:00
Xiang Xiao
deaa6c5b7b build: Replace $(TOPDIR)/Make.defs with $(APPDIR)/Make.defs
and move NUTTXLIB defintion to the common place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 15:17:37 -03:00
Xiang Xiao
69f013e74e build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 15:56:35 +01:00
Xiang Xiao
ead498a788 build: Remove the workaround for the inexistence of .config/Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-21 17:43:42 +01:00