2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

[master] cleanup strcat/strcpy

4722.	[cleanup]	Clean up uses of strcpy() and strcat() in favor of
			strlcpy() and strlcat() for safety. [RT #45981]
This commit is contained in:
Evan Hunt
2017-09-13 00:14:37 -07:00
parent 20502f35dd
commit 114f95089c
43 changed files with 194 additions and 162 deletions

View File

@@ -53,16 +53,16 @@ tohexstr(unsigned char *d, unsigned int len, char *out);
isc_result_t
tohexstr(unsigned char *d, unsigned int len, char *out) {
out[0]='\0';
char c_ret[] = "AA";
unsigned int i;
strcat(out, "0x");
int size = len * 2 + 1;
out[0] = '\0';
strlcat(out, "0x", size);
for (i = 0; i < len; i++) {
sprintf(c_ret, "%02X", d[i]);
strcat(out, c_ret);
snprintf(c_ret, sizeof(c_ret), "%02X", d[i]);
strlcat(out, c_ret, size);
}
strcat(out, "\0");
return (ISC_R_SUCCESS);
}