Added NAMELENGTH and getnstr

To avoid buffer overflowing, used a length-checking string functio n
Merge pull request #1 from s3krit/master

Added NAMELENGTH and getnstr