From e8804e36b1ad39fed21462f5715eaac2d2781ae7 Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Mon, 30 Nov 2015 17:27:10 +0100 Subject: [PATCH] use snprintf to prevent buffer overflow fixes places missed with 52f494e fixes CID 27968 found by Coverity --- vda/vda.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vda/vda.cpp b/vda/vda.cpp index b47cec8140..e6f0fc33a4 100644 --- a/vda/vda.cpp +++ b/vda/vda.cpp @@ -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;