use snprintf to prevent buffer overflow

fixes places missed with 52f494e
fixes CID 27968 found by Coverity
This commit is contained in:
Christian Beer 2015-11-30 17:27:10 +01:00
parent f7cf1408b6
commit e8804e36b1
1 changed files with 3 additions and 3 deletions

View File

@ -150,7 +150,7 @@ int handle_add(const char* path) {
int handle_remove(const char* name) {
DB_VDA_FILE vf;
char buf[1024];
sprintf(buf, "where file_name='%s'", name);
snprintf(buf, sizeof(buf), "where file_name='%s'", name);
int retval = vf.lookup(buf);
if (retval) return retval;
@ -178,7 +178,7 @@ int handle_remove(const char* name) {
int handle_retrieve(const char* name) {
DB_VDA_FILE vf;
char buf[1024];
sprintf(buf, "where file_name='%s'", name);
snprintf(buf, sizeof(buf), "where file_name='%s'", name);
int retval = vf.lookup(buf);
if (retval) return retval;
retval = vf.update_field("retrieving=1, need_update=1");
@ -188,7 +188,7 @@ int handle_retrieve(const char* name) {
int handle_status(const char* name) {
DB_VDA_FILE dvf;
char buf[1024];
sprintf(buf, "where file_name='%s'", name);
snprintf(buf, sizeof(buf), "where file_name='%s'", name);
int retval = dvf.lookup(buf);
if (retval) return retval;