mirror of
https://github.com/cc65/cc65.git
synced 2025-02-26 23:30:03 +00:00
Made some string output functions reject an invalid NULL buffer pointer.
This commit is contained in:
parent
219905c6bc
commit
146daa1d0a
@ -86,9 +86,16 @@ L1: dex
|
|||||||
sta bufptr+0
|
sta bufptr+0
|
||||||
stx bufptr+1
|
stx bufptr+1
|
||||||
|
|
||||||
|
; There must be a buffer if its size is non-zero.
|
||||||
|
|
||||||
|
bit bufsize+1
|
||||||
|
bmi L5
|
||||||
|
ora bufptr+1
|
||||||
|
bze L0 ; The pointer shouldn't be NULL
|
||||||
|
|
||||||
; Restore ap and call _printf
|
; Restore ap and call _printf
|
||||||
|
|
||||||
pla
|
L5: pla
|
||||||
tax
|
tax
|
||||||
pla
|
pla
|
||||||
jsr __printf
|
jsr __printf
|
||||||
@ -125,6 +132,11 @@ L4: lda ccount+0
|
|||||||
; Bail out if size is too high.
|
; Bail out if size is too high.
|
||||||
|
|
||||||
L9: lda #ERANGE
|
L9: lda #ERANGE
|
||||||
|
.byte $2C ;(bit $xxxx)
|
||||||
|
|
||||||
|
; NULL buffer pointers usually are invalid.
|
||||||
|
|
||||||
|
L0: lda #EINVAL
|
||||||
jsr __directerrno ; Return -1
|
jsr __directerrno ; Return -1
|
||||||
jmp incsp6 ; Drop parameters
|
jmp incsp6 ; Drop parameters
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user