dirtmp[p - fn] = 0;
dir = dirtmp;
} else if (dir && dir[0] && strcmp(dir, ".") != 0) {
- sprintf(dirtmp, "%s/%s", dir, fn);
+ snprintf(dirtmp, sizeof(dirtmp), "%s/%s", dir, fn);
fn = dirtmp;
}
break;
default:
if (*str < 32 || (*str >= 128)){
- sprintf(out, "\\%03o", *str);
+ snprintf(out, outlen, "\\%03o", *str);
done += 4;
out += 4;
+ outlen -= 4;
} else {
*out++ = *str;
+ outlen--;
done++;
}
}
if (sp) {
*out++ = '\\';
*out++ = sp;
+ outlen -= 2;
done += 2;
}
str++;
!= NULL)
a = v->name;
else {
- sprintf(buf, "%d", vp->lvalue);
+ snprintf(buf, sizeof(buf), "%d", vp->lvalue);
a = buf;
}
break;
return 0;
}
- sprintf(out, "%s = ", vp->name);
+ snprintf(out, outlen, "%s = ", vp->name);
len = strlen(out);
vp_prints_value(out + len, outlen - len, vp, 1);
memset(pair, 0, sizeof(VALUE_PAIR));
if ((attr = dict_attrbyvalue(attribute)) == NULL) {
- sprintf(pair->name, "Attr-%d", attribute);
+ snprintf(pair->name, sizeof(pair->name), "Attr-%d", attribute);
pair->type = PW_TYPE_STRING;
} else {
strcpy(pair->name, attr->name);