Skip to content

Commit afe73d8

Browse files
6by9pelwell
authored andcommitted
input: edt-ft5x06: Correct prefix length in snprintf
snprintf takes the length of the array that we can print into, and has to fit the NULL terminator in there too. Printing the prefix is generally "12-3456 " which is 8 desired characters (the length of EDT_NAME_PREFIX_LEN) and the NULL. The space is therefore being truncated to fit the NULL in. Increase the length snprintf is allowed to use. Signed-off-by: Dave Stevenson <[email protected]>
1 parent ec2949a commit afe73d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/touchscreen/edt-ft5x06.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client,
938938
char *model_name = tsdata->name;
939939
char *fw_version = tsdata->fw_version;
940940

941-
snprintf(model_name, EDT_NAME_PREFIX_LEN, "%s ", dev_name(&client->dev));
941+
snprintf(model_name, EDT_NAME_PREFIX_LEN + 1, "%s ", dev_name(&client->dev));
942942
model_name += strlen(model_name);
943943

944944
/* see what we find if we assume it is a M06 *

0 commit comments

Comments
 (0)