From b2b705aa33be8140f735fc993928513ff00968d3 Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Sat, 20 Sep 2014 16:40:52 +0300 Subject: Fail when NULL is passed to CreateFileListInfo() Passing NULL to sprintf() would most likely crash the program. --- libvncserver/tightvnc-filetransfer/filetransfermsg.c | 8 ++++++-- 1 file 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(), "/"); } -- cgit v1.1