summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Cohen Gindi <danielgindi@gmail.com>2014-09-20 16:40:52 +0300
committerDaniel Cohen Gindi <danielgindi@gmail.com>2014-09-20 17:46:31 +0300
commitb2b705aa33be8140f735fc993928513ff00968d3 (patch)
treecb5cc4fbad252637480829a2d5e3750e9076f9d1
parentfbf48c65f343c2d3cce8ccd69975e9526f209fc5 (diff)
downloadlibvncserver-b2b705aa33be8140f735fc993928513ff00968d3.zip
libvncserver-b2b705aa33be8140f735fc993928513ff00968d3.tar.gz
Fail when NULL is passed to CreateFileListInfo()
Passing NULL to sprintf() would most likely crash the program.
-rw-r--r--libvncserver/tightvnc-filetransfer/filetransfermsg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.c b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
index a0d7a5e..3cda84a 100644
--- a/libvncserver/tightvnc-filetransfer/filetransfermsg.c
+++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
@@ -109,8 +109,12 @@ CreateFileListInfo(FileListInfoPtr pFileListInfo, char* path, int flag)
{
DIR* pDir = NULL;
struct dirent* pDirent = NULL;
-
- if((path == NULL) || (strlen(path) == 0)) {
+
+ if(path == NULL) {
+ return FAILURE;
+ }
+
+ if(strlen(path) == 0) {
/* In this case we will send the list of entries in ftp root*/
sprintf(path, "%s%s", GetFtpRoot(), "/");
}
OpenPOWER on IntegriCloud