commit 99fd9ff4bf6d3bee4a29f13ef4ae81aa36fdd4d5 from: Omar Polo date: Thu Nov 17 11:27:48 2022 UTC always cast ctype' is*() arguments to unsigned char ok stsp@ commit - a45aafaf9bf7910fed713ff35d6d051d463bae98 commit + 99fd9ff4bf6d3bee4a29f13ef4ae81aa36fdd4d5 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 - 114e0ca8c6f110af5f8ebfd87ac1cdd552fbc92c blob + d462598db9e15145bb7cda1fc9ca7357de35b04a --- lib/object_parse.c +++ lib/object_parse.c @@ -410,12 +410,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 - 4fa55782d6cfa72a92ffedfb310e3ac0e508e55c blob + 07e2042c17a6d66588622b9d6a7fb1e9c158cfbd --- 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 - 7069d8b17d0928e260d85033e81ff7ac104c27dd blob + 1d25734c98460f62110adce7185d5a73c017c8ad --- libexec/got-send-pack/got-send-pack.c +++ libexec/got-send-pack/got-send-pack.c @@ -181,7 +181,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];