diff --git a/libmisc/tz.c b/libmisc/tz.c index f3f5733e..9f3a41f2 100644 --- a/libmisc/tz.c +++ b/libmisc/tz.c @@ -42,7 +42,8 @@ strcpy (tzbuf, def_tz); } else { - tzbuf[strlen (tzbuf) - 1] = '\0'; + /* Remove optional trailing '\n'. */ + tzbuf[strcspn (tzbuf, "\n")] = '\0'; } if (NULL != fp) {