I have to be missing something obvious here, but I can't seem to find the end of a string.
My code starts off with a few calls that read as follows:
; read user input
;
mov eax, SYSCALL_READ ; read function
mov ebx, STDIN ; Arg 1: file descriptor
mov ecx, buf ; Arg 2: address of buffer (buffer is input)
mov edx, BUFLEN ; Arg 3: buffer length (defined as 256)
int 080h
mov [rlen], eax ; save length of string read
The professor gave us a shell program to work from, but I've got a pretty good handle on most of it. What's throwing me off is that I was of the impression that rlen should now contain the length of the string I'm using, but when I type the following:
mov byte[esi + rlen], 92 ; add a zero
I get a segfault. Same, also, if I use [buf + rlen]. Neither buf nor ESI on their own cause a segfault, so it seems to me that rlen isn't doing what I think it is.
Anyone able to help me figure out what's going on?