phoenix-rtos / phoenix-rtos-utils Goto Github PK
View Code? Open in Web Editor NEWPhoenix-RTOS utils
License: BSD 3-Clause "New" or "Revised" License
Phoenix-RTOS utils
License: BSD 3-Clause "New" or "Revised" License
phoenix-rtos-utils/core/psh/mem/mem.c: In function 'psh_mem_procprint':
phoenix-rtos-utils/core/psh/mem/mem.c:85:20: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'id_t' {aka 'unsigned int'} [-Wformat=]
85 | printf(" %d.%llu", e->oid.port, e->oid.id);
| ~~~^ ~~~~~~~~~
| | |
| long long unsigned int id_t {aka unsigned int}
| %u
Example build from ghactions: https://github.com/phoenix-rtos/phoenix-rtos-project/runs/2792844210?check_suite_focus=true#step:4:260
Variable op_seecondary
is always set to 1
.
phoenix-rtos-utils/core/psh/reboot/reboot.c
Lines 40 to 50 in 48a626a
At this moment, when trying to execute a sysexec
command with a syspage program, which is not on the white list we print a message Unknown command
. It is misleading, as it suggests to the user, that the command itself does not exist or he/she made a mistake when executing the command. We should change it to for example sysexec: Command not allowed
or even explicitly: sysexec: Program micropython not found on the whitelist
, whichever you prefer.
Currently psh
exits always with 0
which makes any of the applets unusable in complex environment.
Also: revisit psh applet return codes, as only the lower 8 bits are passed to the parent process - so returning negative values might not be the best idea.
For details see: https://pubs.opengroup.org/onlinepubs/007904875/functions/exit.html
Move flashsrv dependent code to separate directories (e.g. nand, nor)
psh/psh.c:
int main(int argc, char **argv)
...
if ((args = calloc(3000, 1)) == NULL) {
printf("psh: out of memory\n");
return EXIT_FAILURE;
}
for (c = 1; c < argc; ++c) {
strcat(args, argv[c]);
strcat(args, " ");
}
...
Appending to args
is done without any control of the possible args
buffer overflow.
What happens if the sum of the length of the arguments is greater than 3000?
Why the number 3000? Can it be greater than 3000 at all?
In psh_run
is 128
void psh_run(void)
...
char buf[128];
It would probably be appropriate to use the :
strncat(char *, const char *, size_t)
but now this function does nothing.
libphoenix/string/string.c
char *strncat(char *s1, const char *s2i, size_t num)
{
return 0;
}
I also don't see:
free(args);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.