mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-02-07 04:30:31 +00:00
Ensure that strtok returns NULL after reaching the end of the string.
It had been doing a null pointer dereference and effectively treating memory locations starting from 0 as the continuation of the string, potentially producing inappropriate results depending on what they contained.
This commit is contained in:
parent
887d66d537
commit
d89096236e
@ -1730,15 +1730,17 @@ lb3 lda isp s := internal state pointer
|
||||
ldx isp+2
|
||||
sta s
|
||||
stx s+2
|
||||
ora s+2 check if already at end of string
|
||||
beq lb4a
|
||||
lb4 anop endif
|
||||
|
||||
lda [s] if we are at the end of the string then
|
||||
and #$00FF
|
||||
bne lb5
|
||||
stz set return NULL
|
||||
stz set+2
|
||||
stz isp set the isp to NULL
|
||||
stz isp+2
|
||||
lb4a stz set return NULL
|
||||
stz set+2
|
||||
bra lb10 else
|
||||
lb5 lda [s] scan to the 1st char not in the set
|
||||
and #$00FF
|
||||
|
Loading…
x
Reference in New Issue
Block a user