From fb3ce8554cb63f5939139fbdaca6ac0cf264b55a Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 10 Jun 2017 01:25:17 +0300 Subject: datatrak.c: don't use POSIX %m format for sscanf() in dtrak_prepare_data() The format option "%m" doesn't work for MINGW/Windows and is reported as an unknown conversation type and this sscanf() call would not work. The alternative is to malloc() enough space manually - e.g. strlen(input) + 1. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- core/datatrak.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/datatrak.c b/core/datatrak.c index e61e5c1c8..2f827c1bc 100644 --- a/core/datatrak.c +++ b/core/datatrak.c @@ -115,7 +115,8 @@ static int dtrak_prepare_data(int model, device_data_t *dev_data) while (model != g_models[i].model_num && g_models[i].model_num != 0xEE) i++; dev_data->model = copy_string(g_models[i].name); - sscanf(g_models[i].name,"%m[A-Za-z] ", &dev_data->vendor); + dev_data->vendor = (const char *)malloc(strlen(g_models[i].name) + 1); + sscanf(g_models[i].name, "%[A-Za-z] ", (char *)dev_data->vendor); dev_data->product = copy_string(strchr(g_models[i].name, ' ') + 1); d = get_descriptor(g_models[i].type, g_models[i].libdc_num); -- cgit v1.2.3-70-g09d2