- if (check8bit) {
- for (cp = buffer; *cp; cp++) {
- if (!isascii ((unsigned char) *cp)) {
- contains8bit = 1;
- check8bit = 0; /* no need to keep checking */
- }
+ for (cp = bufp; (check8bit || checknul) &&
+ cp < bufp + gotlen; cp++) {
+ if (!isascii ((unsigned char) *cp)) {
+ contains8bit = 1;
+ check8bit = 0; /* no need to keep checking */
+ }
+ if (!*cp) {
+ containsnul = 1;
+ checknul = 0; /* no need to keep checking */