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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user