int val;
val = *(int *)elem->dst;
- sprintf(numbuf, "%d", val);
+ snprintf(numbuf, sizeof(numbuf), "%d", val);
return numbuf;
}
bool cf_set_time(ConfElem *elem, const char *val, PgSocket *console)
usec_t val;
val = *(usec_t *)elem->dst;
- sprintf(numbuf, "%d", (int)(val / USEC));
+ snprintf(numbuf, sizeof(numbuf), "%d", (int)(val / USEC));
return numbuf;
}
return;
pid = getpid();
- sprintf(buf, "%u", (unsigned)pid);
+ snprintf(buf, sizeof(buf), "%u", (unsigned)pid);
fd = open(cf_pidfile, O_WRONLY | O_CREAT | O_EXCL, 0644);
if (fd < 0)
va_start(ap, tupdesc);
for (i = 0; i < ncol; i++) {
if (tupdesc[i] == 'i') {
- sprintf(tmp, "%d", va_arg(ap, int));
+ snprintf(tmp, sizeof(tmp), "%d", va_arg(ap, int));
val = tmp;
} else if (tupdesc[i] == 'q') {
- sprintf(tmp, "%" PRIu64, va_arg(ap, uint64_t));
+ snprintf(tmp, sizeof(tmp), "%" PRIu64, va_arg(ap, uint64_t));
val = tmp;
} else if (tupdesc[i] == 's') {
val = va_arg(ap, char *);