FILE *f;
int ret;
- sprintf(buf, "//sys//class//net//%s//pkey", ifreq->ifr_name);
+ snprintf(buf, sizeof buf, "//sys//class//net//%s//pkey", ifreq->ifr_name);
f = fopen(buf, "r");
if (!f) {
printf("failed to open %s\n", buf);
FILE *f;
int i, p, ret;
- sprintf(buf, "//sys//class//net//%s//address", ifr->ifr_name);
+ snprintf(buf, sizeof buf, "//sys//class//net//%s//address", ifr->ifr_name);
f = fopen(buf, "r");
if (!f) {
printf("failed to open %s\n", buf);
case ACM_EP_INFO_PATH:
path = (struct ibv_path_record *) addr;
if (path->dlid) {
- sprintf(name, "SLID(%u) DLID(%u)",
+ snprintf(name, name_size, "SLID(%u) DLID(%u)",
ntohs(path->slid), ntohs(path->dlid));
} else {
acm_format_name(level, name, name_size, ACM_ADDRESS_GID,
}
break;
case ACM_ADDRESS_LID:
- sprintf(name, "LID(%u)", ntohs(*((uint16_t *) addr)));
+ snprintf(name, name_size, "LID(%u)", ntohs(*((uint16_t *) addr)));
break;
default:
strcpy(name, "Unknown");
return -1;
}
- sprintf(pid, "%d\n", getpid());
+ snprintf(pid, sizeof pid, "%d\n", getpid());
write(lock_fd, pid, strlen(pid));
return 0;
}
}
while (from <= to) {
- sprintf(buf, "%s%0*d", basename, width, from);
+ snprintf(buf, sizeof buf, "%s%0*d", basename, width, from);
str_buf = realloc(str_buf, size + strlen(buf)+1);
strcpy(&str_buf[size], buf);