mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
i/o devices: use strlcpy instead of strcpy
FossilOrigin-Name: fcd8cd5bee462dcd652328e689afa92f312b71b3d259fdb69739865c8ae99e44
This commit is contained in:
parent
d7ae8b1497
commit
357d9256d6
2 changed files with 19 additions and 19 deletions
|
@ -134,9 +134,9 @@ void gopher_fetch(char *host, CELL port, char *selector, CELL dest) {
|
|||
void ngaGopherUnit() {
|
||||
CELL port, dest;
|
||||
char server[1025], selector[4097];
|
||||
strcpy(selector, string_extract(stack_pop()));
|
||||
strlcpy(selector, string_extract(stack_pop()), 4096);
|
||||
port = stack_pop();
|
||||
strcpy(server, string_extract(stack_pop()));
|
||||
strlcpy(server, string_extract(stack_pop()), 1024);
|
||||
dest = stack_pop();
|
||||
gopher_fetch(server, port, selector, dest);
|
||||
}
|
||||
|
|
|
@ -139,38 +139,38 @@ void unix_fork() {
|
|||
---------------------------------------------------------------------*/
|
||||
|
||||
void unix_exec0() {
|
||||
char path[1024];
|
||||
strcpy(path, string_extract(stack_pop()));
|
||||
char path[1025];
|
||||
strlcpy(path, string_extract(stack_pop()), 1024);
|
||||
execl(path, path, (char *)0);
|
||||
stack_push(errno);
|
||||
}
|
||||
|
||||
void unix_exec1() {
|
||||
char path[1024];
|
||||
char arg0[1024];
|
||||
strcpy(arg0, string_extract(stack_pop()));
|
||||
strcpy(path, string_extract(stack_pop()));
|
||||
char path[1025];
|
||||
char arg0[1025];
|
||||
strlcpy(arg0, string_extract(stack_pop()), 1024);
|
||||
strlcpy(path, string_extract(stack_pop()), 1024);
|
||||
execl(path, path, arg0, (char *)0);
|
||||
stack_push(errno);
|
||||
}
|
||||
|
||||
void unix_exec2() {
|
||||
char path[1024];
|
||||
char arg0[1024], arg1[1024];
|
||||
strcpy(arg1, string_extract(stack_pop()));
|
||||
strcpy(arg0, string_extract(stack_pop()));
|
||||
strcpy(path, string_extract(stack_pop()));
|
||||
char path[1025];
|
||||
char arg0[1025], arg1[1025];
|
||||
strlcpy(arg1, string_extract(stack_pop()), 1024);
|
||||
strlcpy(arg0, string_extract(stack_pop()), 1024);
|
||||
strlcpy(path, string_extract(stack_pop()), 1024);
|
||||
execl(path, path, arg0, arg1, (char *)0);
|
||||
stack_push(errno);
|
||||
}
|
||||
|
||||
void unix_exec3() {
|
||||
char path[1024];
|
||||
char arg0[1024], arg1[1024], arg2[1024];
|
||||
strcpy(arg2, string_extract(stack_pop()));
|
||||
strcpy(arg1, string_extract(stack_pop()));
|
||||
strcpy(arg0, string_extract(stack_pop()));
|
||||
strcpy(path, string_extract(stack_pop()));
|
||||
char path[1025];
|
||||
char arg0[1025], arg1[1025], arg2[1025];
|
||||
strlcpy(arg2, string_extract(stack_pop()), 1024);
|
||||
strlcpy(arg1, string_extract(stack_pop()), 1024);
|
||||
strlcpy(arg0, string_extract(stack_pop()), 1024);
|
||||
strlcpy(path, string_extract(stack_pop()), 1024);
|
||||
execl(path, path, arg0, arg1, arg2, (char *)0);
|
||||
stack_push(errno);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue