use snprintf to prevent buffer overflow

fixes CID 27939 found by Coverity
This commit is contained in:
Christian Beer 2015-10-21 17:01:12 +02:00
parent 145942cbb3
commit e2508a0d36
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ int main(int argc, char** argv) {
if (!strcmp(argv[1], "--name")) {
DB_WORKUNIT wu;
char buf[256];
sprintf(buf, "where name='%s'", argv[2]);
snprintf(buf, sizeof(buf), "where name='%s'", argv[2]);
retval = wu.lookup(buf);
if (retval) {
fprintf(stderr, "No workunit named '%s'\n", argv[2]);