commit 6771d4253a7655812f9e1b5f25d98d86ec416951 from: Omar Polo via: Thomas Adam date: Thu Nov 17 21:39:27 2022 UTC always cast ctype' is*() arguments to unsigned char ok stsp@ commit - 7c55ad47894887b0799d0f0bb8d93419f51ade61 commit + 6771d4253a7655812f9e1b5f25d98d86ec416951 blob - a487dffb531fb051aa859f3c1ac13816fdfcd926 blob + 6f80f2dd7f9d638f38ae4b28c4b4b1e0f480b7fe --- lib/gitproto.c +++ lib/gitproto.c @@ -54,13 +54,13 @@ tokenize_line(char **tokens, char *line, int len, int tokens[i] = NULL; for (i = 0; n < len && i < maxtokens; i++) { - while (isspace(*line)) { + while (isspace((unsigned char)*line)) { line++; n++; } p = line; while (*line != '\0' && n < len && - (!isspace(*line) || i == maxtokens - 1)) { + (!isspace((unsigned char)*line) || i == maxtokens - 1)) { line++; n++; } blob - 72688b31fe92da99ea51212e6c99f94859c65703 blob + c25b1b51046c5e8f1caf61ece410b255a0b9df4d --- lib/object_parse.c +++ lib/object_parse.c @@ -409,12 +409,14 @@ parse_gmtoff(time_t *gmtoff, const char *tzstr) else if (*p != '+') return got_error(GOT_ERR_BAD_OBJ_DATA); p++; - if (!isdigit(*p) && !isdigit(*(p + 1))) + if (!isdigit((unsigned char)*p) && + !isdigit((unsigned char)*(p + 1))) return got_error(GOT_ERR_BAD_OBJ_DATA); h = (((*p - '0') * 10) + (*(p + 1) - '0')); p += 2; - if (!isdigit(*p) && !isdigit(*(p + 1))) + if (!isdigit((unsigned char)*p) && + !isdigit((unsigned char)*(p + 1))) return got_error(GOT_ERR_BAD_OBJ_DATA); m = ((*p - '0') * 10) + (*(p + 1) - '0'); blob - 52cedcef2588aa0c074d4d486c05e33a3bac7eb4 blob + 4330e9e71a7dcd41735ee2f4222e4f39e824d121 --- lib/pkt.c +++ lib/pkt.c @@ -144,7 +144,7 @@ got_pkt_readpkt(int *outlen, int fd, char *buf, int bu if (chattygot > 1) { fprintf(stderr, "%s: readpkt: %zd:\t", getprogname(), n); for (i = 0; i < n; i++) { - if (isprint(buf[i])) + if (isprint((unsigned char)buf[i])) fputc(buf[i], stderr); else fprintf(stderr, "[0x%.2x]", buf[i]); @@ -179,7 +179,7 @@ got_pkt_writepkt(int fd, char *buf, int nbuf, int chat if (chattygot > 1) { fprintf(stderr, "%s: writepkt: %s:\t", getprogname(), len); for (i = 0; i < nbuf; i++) { - if (isprint(buf[i])) + if (isprint((unsigned char)buf[i])) fputc(buf[i], stderr); else fprintf(stderr, "[0x%.2x]", buf[i]); blob - 8bc2915d90c8ece2b75b50b15d013841faaad3ef blob + 1be0d09b5fe92108c81739e8bfa13d5c2068bb2b --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -208,7 +208,7 @@ fetch_error(const char *buf, size_t len) size_t i; for (i = 0; i < len && i < sizeof(msg) - 1; i++) { - if (!isprint(buf[i])) + if (!isprint((unsigned char)buf[i])) return got_error_msg(GOT_ERR_BAD_PACKET, "non-printable error message received from server"); msg[i] = buf[i]; blob - 40bd3e57d66c071b282b6f8d8bd9fec8fa887d49 blob + dfc7acc527035a5e798618a09fb1e1b57020650e --- libexec/got-send-pack/got-send-pack.c +++ libexec/got-send-pack/got-send-pack.c @@ -179,7 +179,7 @@ send_error(const char *buf, size_t len) size_t i; for (i = 0; i < len && i < sizeof(msg) - 1; i++) { - if (!isprint(buf[i])) + if (!isprint((unsigned char)buf[i])) return got_error_msg(GOT_ERR_BAD_PACKET, "non-printable error message received from server"); msg[i] = buf[i];