notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ba4ecb8
)
psxbios: Add checks for strcpy & strncpy.
author
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:28:22 +0000
(
02:28
+0200)
committer
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:28:22 +0000
(
02:28
+0200)
This should be closer to documentation.
libpcsxcore/psxbios.c
patch
|
blob
|
blame
|
history
diff --git
a/libpcsxcore/psxbios.c
b/libpcsxcore/psxbios.c
index
be3abb8
..
13cfe73
100644
(file)
--- a/
libpcsxcore/psxbios.c
+++ b/
libpcsxcore/psxbios.c
@@
-630,6
+630,12
@@
void psxBios_strncmp() { // 0x18
void psxBios_strcpy() { // 0x19
char *p1 = (char *)Ra0, *p2 = (char *)Ra1;
+ if (a0 == 0 || a1 == 0)
+ {
+ v0 = 0;
+ pc0 = ra;
+ return;
+ }
while ((*p1++ = *p2++) != '\0');
v0 = a0; pc0 = ra;
@@
-638,7
+644,12
@@
void psxBios_strcpy() { // 0x19
void psxBios_strncpy() { // 0x1a
char *p1 = (char *)Ra0, *p2 = (char *)Ra1;
s32 n = a2, i;
-
+ if (a0 == 0 || a1 == 0)
+ {
+ v0 = 0;
+ pc0 = ra;
+ return;
+ }
for (i = 0; i < n; i++) {
if ((*p1++ = *p2++) == '\0') {
while (++i < n) {