I encountered something weird while trying C read function. I know file descriptor 0 means standard input. So I decided to take input with read function like below
#include<unistd.h>
int main(){
char buf[1];
read(0,buf,1);
return 0;
}
I compiled that main.c file with gcc
$ gcc -o main main.c
then I executed main binary and then entered input 'tls'. Characters after 't' are interpreted by the shell and output was like the following
$ ./main
tls
$ ls
main main.c
Why the shell directly interprets overflown input characters?