fix precision lose warning by casting result of strlen() to (int) type
further protect result of strlen() with a make to limit the result value