Scope hiding fixes
strcmp() --> strncmp()
Null pointer checks