unix,win: fix 'sprintf' is deprecated warning (#3813)

This commit is contained in:
twosee 2022-11-08 16:56:14 +08:00 committed by GitHub
parent a7b16bfb33
commit ec5130c3f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,7 +130,7 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) {
tp += strlen(tp);
break;
}
tp += sprintf(tp, "%x", words[i]);
tp += snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words))