Update decode.c
Update encode.c
Merge pull request #3 from prasad83/master

Need to avoid buffer underflow before adding '\0' (encode & decode)