admin管理员组文章数量:1368007
I am trying to extract a file path from an HTTP request in x86-64 assembly. However, the extracted path appears to be an empty string when I try to use it with the open
syscall. The HTTP request is correctly read into a buffer, but the parsing logic might be failing. What might be the problem? Thanks.
lea rsi, [read_buffer] # <- HTTP request
xor rcx, rcx
find_first_space:
mov al, byte [rsi + rcx]
test al, al
jz done_copy
cmp al, ' '
je start_copy
inc rcx
jmp find_first_space
start_copy:
inc rcx
lea rdi, [path_buffer]
xor rdx, rdx
copy_path:
mov al, byte [rsi + rcx]
test al, al
jz done_copy
cmp al, ' '
je done_copy
mov byte [rdi + rdx], al
inc rdx
inc rcx
jmp copy_path
done_copy:
mov byte ptr [rdi + rdx], 0
I tried extracting the file path from the HTTP request by searching for the first space after GET, then copying characters until the next space. I expected path_buffer
to contain the extracted file path (e.g., /path/to/file), but instead, it ends up empty (""). This causes the open
syscall to fail since it's receiving an invalid file path."
本文标签: linuxCan39t extract a path from HTTP request in assemblyStack Overflow
版权声明:本文标题:linux - Can't extract a path from HTTP request in assembly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743736119a2530043.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论