1296,7 → 1296,6 |
invoke mem.alloc, URLMAXLEN ; FIXME: use length provided by caller to guess final size. |
test eax, eax |
jz .error |
mov edx, URLMAXLEN-1 ; Remaining space in temp buffer minus one for 0 byte |
mov [esp + 7 * 4], eax ; return ptr in eax |
mov esi, [URI] |
mov edi, eax |
1316,13 → 1315,9 |
jc .escape |
|
stosb |
dec edx |
jnz .loop |
jmp .out_of_space |
jmp .loop |
|
.escape: |
sub edx, 3 |
jbe .out_of_space |
mov al, '%' |
stosb |
mov bl, byte[esi-1] |
1336,11 → 1331,7 |
jmp .loop |
|
|
.out_of_space: |
DEBUGF 2, "ERROR: buffer too small!\n" |
|
.done: |
xor al, al |
stosb |
sub edi, [esp + 7 * 4] |
dec edi |
1376,7 → 1367,6 |
invoke mem.alloc, URLMAXLEN ; FIXME: use length provided by caller |
test eax, eax |
jz .error |
mov edx, URLMAXLEN-1 ; Remaining space in temp buffer minus one for 0 byte |
mov [esp + 7 * 4], eax ; return ptr in eax |
mov esi, [URI] |
mov edi, eax |
1387,9 → 1377,7 |
cmp al, '%' |
je .unescape |
stosb |
dec edx |
jnz .loop |
jmp .out_of_space |
jmp .loop |
|
.unescape: |
xor ebx, ebx |
1414,19 → 1402,13 |
jc .unescape_nibble |
mov al, bl |
stosb |
dec edx |
jnz .loop |
jmp .out_of_space |
jmp .loop |
|
.fail: |
DEBUGF 2, "ERROR: invalid URI!\n" |
jmp .loop |
|
.out_of_space: |
DEBUGF 2, "ERROR: buffer too small!\n" |
|
.done: |
xor al, al |
stosb |
popa |
DEBUGF 1, "unescaped URL: %s\n", eax |