Just copy the \0 also from the first string or just add one at the end and then you will get the buffer calculated by strlen correct.

strlen returns the no where it finds \0

Try changing
while(i<strlen(s1)){
to
while(i<=strlen(s1)){