Fix misuse of "%*s" in sprintf strings

%*s takes the output length, not the input length. The intended
specifier was %.*s in several places. Bug(s) introduced in
2bb31f05ee
This commit is contained in:
Evan Miller
2021-01-21 18:27:20 -05:00
parent 848303f9f0
commit f1eac042b5
4 changed files with 4 additions and 4 deletions

View File

@@ -486,7 +486,7 @@ mdb_sql_add_sarg(MdbSQL *sql, char *col_name, int op, char *constant)
** column definition can be checked for validity
*/
if (constant[0]=='\'') {
snprintf(node->value.s, sizeof(node->value.s), "%*s", (int)strlen(constant) - 2, &constant[1]);
snprintf(node->value.s, sizeof(node->value.s), "%.*s", (int)strlen(constant) - 2, &constant[1]);
node->val_type = MDB_TEXT;
} else if ((p=strchr(constant, '.'))) {
*p=localeconv()->decimal_point[0];