From d8908995c79f7d2a6057852b5c2c4f555072445c Mon Sep 17 00:00:00 2001 From: jonnosan Date: Wed, 30 Dec 2009 10:52:03 +0000 Subject: [PATCH] FIX: more than 3 dots in a dotted quad would crash the hostname resolver git-svn-id: http://svn.code.sf.net/p/netboot65/code@243 93682198-c243-4bdb-bd91-e943c89aac3b --- client/ip65/dottedquad.s | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/ip65/dottedquad.s b/client/ip65/dottedquad.s index 6cf401d..bfdc345 100644 --- a/client/ip65/dottedquad.s +++ b/client/ip65/dottedquad.s @@ -8,7 +8,13 @@ .bss dotted_quad_value: .res 4 ;set to 32 bit ip address on a succesful call to parse_dotted_quad - dotted_quad_ptr: .res 4 + .data + + ;self modifying code + dotted_quad_ptr: + lda $FFFF + rts + .code @@ -22,13 +28,7 @@ ; dotted_quad_value: will be set to (32 bit) ip address (if no error) ; (*) NB to assist with url parsing, a ':' or '/' can also terminate the string parse_dotted_quad: - stax dotted_quad_ptr+1 - - lda #$AD ; $AD='LDA immediate' - sta dotted_quad_ptr - - lda #$60 ; $60='RTS - sta dotted_quad_ptr+3 + stax dotted_quad_ptr+1 ldx #0 txa sta dotted_quad_value @@ -61,6 +61,8 @@ parse_dotted_quad: @got_dot: inx + cpx #4 + beq @error lda #0 sta dotted_quad_value,x jmp @each_byte