replace strcmp by strncmp for security reasons
fix comparision beetween signed and unsigned integers