summaryrefslogtreecommitdiffstats
path: root/core/datatrak.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-06-10 01:25:17 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-11 15:56:41 -0700
commitfb3ce8554cb63f5939139fbdaca6ac0cf264b55a (patch)
tree6995331c05e189ee2f75b747b6cad058e93250dc /core/datatrak.c
parent74bf8d5260a64d39a27c9703d4747fecc475fdc8 (diff)
downloadsubsurface-fb3ce8554cb63f5939139fbdaca6ac0cf264b55a.tar.gz
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 <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/datatrak.c')
-rw-r--r--core/datatrak.c3
1 files changed, 2 insertions, 1 deletions
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);