You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setlocale(LC_COLLATE, "C"); /* Except for collation, since load_database() uses a-z *//* Except that "US-ASCII" is preferred to "ANSI_x3.4-1968" in MIME, * even though "ANSI_x3.4-1968" is the official charset name. */if ( ( cs=nl_langinfo( CODESET ) ) !=0L&&strcmp(cs, "ANSI_x3.4-1968") !=0 )
strncpy( cron_default_mail_charset, cs, MAX_ENVSTR );
elsestrcpy( cron_default_mail_charset, "US-ASCII" );
But nl_langinfo() can return ANSI_X3.4-1968. Note the upper-case 'X'. This results in cron_default_mail_charset acquiring that value instead of the intended US-ASCII.
It's not clear whether any environment returns the lower-case 'x', but the simplest fix is to replace strcmp with the case-insensitive strcasecmp(3). (strings.h or string.h)
You can demonstrate this with the following Perl on-liner (Perl exposes the same APIs):
In cron.c, line 104 we have:
But
nl_langinfo()
can returnANSI_X3.4-1968
. Note the upper-case 'X'. This results incron_default_mail_charset
acquiring that value instead of the intendedUS-ASCII
.It's not clear whether any environment returns the lower-case 'x', but the simplest fix is to replace
strcmp
with the case-insensitivestrcasecmp(3)
. (strings.h
orstring.h
)You can demonstrate this with the following Perl on-liner (Perl exposes the same APIs):
$ perl -MPOSIX -MI18N::Langinfo=langinfo,CODESET -e'setlocale(LC_ALL,"fr_FRX");print langinfo(CODESET),"\n";' ANSI_X3.4-1968 $
In my case, on
Linux 5.17.12-100.fc34.x86_64
, Perlv5.32.1
;fr_FRX
is not a defined locale.The text was updated successfully, but these errors were encountered: