use snprintf to prevent buffer overflow

fixes CID 27921, 28031 found by Coverity
This commit is contained in:
Christian Beer 2015-10-21 15:39:21 +02:00
parent b1806c2b77
commit 5c7cf964e5
1 changed files with 2 additions and 2 deletions

View File

@ -242,13 +242,13 @@ int main(int argc, char** argv) {
exit(1);
}
sprintf(buf, "where name='%s'", app_name);
snprintf(buf, sizeof(buf), "where name='%s'", app_name);
if (app.lookup(buf)) {
log_messages.printf(MSG_CRITICAL, "can't find app %s\n", app_name);
exit(1);
}
sprintf(buf, "templates/%s", in_template_file);
snprintf(buf, sizeof(buf), "templates/%s", in_template_file);
if (read_file_malloc(config.project_path(buf), in_template)) {
log_messages.printf(MSG_CRITICAL, "can't read input template %s\n", buf);
exit(1);