*** ../bash-5.2-patched/general.c 2021-11-04 14:12:38.000000000 -0400 --- general.c 2022-10-24 10:20:12.000000000 -0400 *************** *** 682,685 **** --- 684,688 ---- { register int i; + int nline; unsigned char c; *************** *** 688,700 **** /* Generally we check the first line for NULs. If the first line looks like ! a `#!' interpreter specifier, we just look for NULs anywhere in the ! buffer. */ ! if (sample[0] == '#' && sample[1] == '!') ! return (memchr (sample, '\0', sample_len) != NULL); for (i = 0; i < sample_len; i++) { c = sample[i]; ! if (c == '\n') return (0); if (c == '\0') --- 691,701 ---- /* Generally we check the first line for NULs. If the first line looks like ! a `#!' interpreter specifier, we look for NULs in the first two lines. */ ! nline = (sample[0] == '#' && sample[1] == '!') ? 2 : 1; for (i = 0; i < sample_len; i++) { c = sample[i]; ! if (c == '\n' && --nline == 0) return (0); if (c == '\0')