improve validation errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <rp6502.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int __fastcall__ close (int fd)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include <rp6502.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int __cdecl__ open (const char* name, int flags, ...)
|
||||
{
|
||||
size_t namelen = strlen (name);
|
||||
if (namelen > 255) {
|
||||
return _mappederrno (EINVAL);
|
||||
RIA.errno = EINVAL;
|
||||
return _mappederrno(RIA.errno);
|
||||
}
|
||||
while (namelen) {
|
||||
ria_push_char (name[--namelen]);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#include <rp6502.h>
|
||||
|
||||
int __fastcall__ stdin_opt (unsigned long ctrl_bits, unsigned char str_length)
|
||||
|
||||
@@ -7,7 +7,8 @@ unsigned char __fastcall__ _sysremove (const char* name)
|
||||
size_t namelen;
|
||||
namelen = strlen (name);
|
||||
if (namelen > 255) {
|
||||
return _mappederrno (EINVAL);
|
||||
RIA.errno = EINVAL;
|
||||
return __mappederrno(RIA.errno);
|
||||
}
|
||||
while (namelen) {
|
||||
ria_push_char (name[--namelen]);
|
||||
|
||||
@@ -8,7 +8,8 @@ unsigned char __fastcall__ _sysrename (const char* oldpath, const char* newpath)
|
||||
oldpathlen = strlen (oldpath);
|
||||
newpathlen = strlen (newpath);
|
||||
if (oldpathlen + newpathlen > 510) {
|
||||
return _mappederrno (EINVAL);
|
||||
RIA.errno = EINVAL;
|
||||
return __mappederrno(RIA.errno);
|
||||
}
|
||||
while (oldpathlen) {
|
||||
ria_push_char (oldpath[--oldpathlen]);
|
||||
|
||||
@@ -5,7 +5,8 @@ int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes)
|
||||
{
|
||||
unsigned i;
|
||||
if (count > 512) {
|
||||
return _mappederrno (EINVAL);
|
||||
RIA.errno = EINVAL;
|
||||
return __mappederrno(RIA.errno);
|
||||
}
|
||||
for (i = count; i;) {
|
||||
ria_push_char (((char*)buf)[--i]);
|
||||
|
||||
Reference in New Issue
Block a user