|
@@ -11,10 +11,10 @@
|
|
|
#endif
|
|
|
|
|
|
static int
|
|
|
-find_device_by_model(char *conffile, char *model, int print)
|
|
|
+find_device_by_model(ssize_t maxlen, char *conffile, char *model, int print)
|
|
|
{
|
|
|
// Check config/%model.conf in the current working directory
|
|
|
- sprintf(conffile, "config/%s.conf", model);
|
|
|
+ snprintf(conffile, maxlen, "config/%s.conf", model);
|
|
|
if (print) {
|
|
|
printf("- %s\n", conffile);
|
|
|
}
|
|
@@ -23,7 +23,7 @@ find_device_by_model(char *conffile, char *model, int print)
|
|
|
}
|
|
|
|
|
|
// Check user overridden /etc/megapixels/config/%model.conf
|
|
|
- sprintf(conffile, "%s/megapixels/config/%s.conf", SYSCONFDIR, model);
|
|
|
+ snprintf(conffile, maxlen, "%s/megapixels/config/%s.conf", SYSCONFDIR, model);
|
|
|
if (print) {
|
|
|
printf("- %s\n", conffile);
|
|
|
}
|
|
@@ -32,7 +32,7 @@ find_device_by_model(char *conffile, char *model, int print)
|
|
|
}
|
|
|
|
|
|
// Check packaged /usr/share/megapixels/config/%model.conf
|
|
|
- sprintf(conffile, "%s/megapixels/config/%s.conf", DATADIR, model);
|
|
|
+ snprintf(conffile, maxlen, "%s/megapixels/config/%s.conf", DATADIR, model);
|
|
|
if (print) {
|
|
|
printf("- %s\n", conffile);
|
|
|
}
|
|
@@ -63,7 +63,7 @@ libmegapixels_find_config_verbose(char *configfile, int print)
|
|
|
}
|
|
|
*(modelptr++) = (char) c;
|
|
|
if (c == 0) {
|
|
|
- if (find_device_by_model(configfile, model, print)) {
|
|
|
+ if (find_device_by_model(sizeof(model), configfile, model, print)) {
|
|
|
return 1;
|
|
|
}
|
|
|
modelptr = model;
|