Use snprintf in client/deps

This commit is contained in:
Doridian committed 2022-06-10 12:29:18 -07:00
1 parent 1711338035
commit fe4599fb14
7 files changed
+35 -35

No files matched your search

+7 -7
View File
@@ -879,9 +879,9 @@ static void addquoted(lua_State *L, luaL_Buffer *b, int arg) {
} else if (*s == '\0' || iscntrl(uchar(*s))) {
char buff[10];
if (!isdigit(uchar(*(s + 1))))
sprintf(buff, "\\%d", (int)uchar(*s));
snprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s));
else
sprintf(buff, "\\%03d", (int)uchar(*s));
snprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s));
luaL_addstring(b, buff);
} else
luaL_addchar(b, *s);
@@ -947,7 +947,7 @@ static int str_format(lua_State *L) {
strfrmt = scanformat(L, strfrmt, form);
switch (*strfrmt++) {
case 'c': {
nb = sprintf(buff, form, luaL_checkint(L, arg));
nb = snprintf(buff, MAX_ITEM, form, luaL_checkint(L, arg));
break;
}
case 'd':
@@ -958,7 +958,7 @@ static int str_format(lua_State *L) {
luaL_argcheck(L, -1 < diff && diff < 1, arg,
"not a number in proper range");
addlenmod(form, LUA_INTFRMLEN);
nb = sprintf(buff, form, ni);
nb = snprintf(buff, MAX_ITEM, form, ni);
break;
}
case 'o':
@@ -971,7 +971,7 @@ static int str_format(lua_State *L) {
luaL_argcheck(L, -1 < diff && diff < 1, arg,
"not a non-negative number in proper range");
addlenmod(form, LUA_INTFRMLEN);
nb = sprintf(buff, form, ni);
nb = snprintf(buff, MAX_ITEM, form, ni);
break;
}
case 'e':
@@ -984,7 +984,7 @@ static int str_format(lua_State *L) {
case 'g':
case 'G': {
addlenmod(form, LUA_FLTFRMLEN);
nb = sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg));
nb = snprintf(buff, MAX_ITEM, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg));
break;
}
case 'q': {
@@ -1000,7 +1000,7 @@ static int str_format(lua_State *L) {
luaL_addvalue(&b);
break;
} else {
nb = sprintf(buff, form, s);
nb = snprintf(buff, MAX_ITEM, form, s);
lua_pop(L, 1); /* remove result from 'luaL_tolstring' */
break;
}