This equality check only works if the LHS is evaluated before the RHS, but this is not guaranteed by the standard. We can fix this by checking that the snprintf return value is less than the maximum buffer length, which also avoids an unnecessary traversal of the string.