From 7ffe422a521735786b5aad0bf462142d32bb743f Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 15 Aug 2005 11:44:35 +0000 Subject: [PATCH] Slightly modified long filenames-patch from Alex Miller git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@977 423420c4-83ab-492f-b58f-81f9feb106b5 --- disk.c | 16 ++++++++-------- rdpdr.c | 2 +- types.h | 8 ++++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/disk.c b/disk.c index cd4cfad..93c7db0 100644 --- a/disk.c +++ b/disk.c @@ -144,10 +144,10 @@ BOOL g_notify_stamp = False; typedef struct { - char name[256]; - char label[256]; + char name[PATH_MAX]; + char label[PATH_MAX]; unsigned long serial; - char type[256]; + char type[PATH_MAX]; } FsInfoType; static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p); @@ -344,7 +344,7 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create NTHANDLE handle; DIR *dirp; int flags, mode; - char path[256]; + char path[PATH_MAX]; struct stat filestat; handle = 0; @@ -491,7 +491,7 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create g_fileinfo[handle].device_id = device_id; g_fileinfo[handle].flags_and_attributes = flags_and_attributes; g_fileinfo[handle].accessmask = accessmask; - strncpy(g_fileinfo[handle].path, path, 255); + strncpy(g_fileinfo[handle].path, path, PATH_MAX-1); g_fileinfo[handle].delete_on_close = False; g_notify_stamp = True; @@ -698,7 +698,7 @@ NTSTATUS disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out) { uint32 length, file_attributes, ft_high, ft_low, delete_on_close; - char newname[256], fullpath[256]; + char newname[PATH_MAX], fullpath[PATH_MAX]; struct fileinfo *pfinfo; int mode; struct stat filestat; @@ -1112,7 +1112,7 @@ NTSTATUS disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out) { uint32 file_attributes, ft_low, ft_high; - char *dirname, fullpath[256]; + char *dirname, fullpath[PATH_MAX]; DIR *pdir; struct dirent *pdirent; struct stat fstat; @@ -1130,7 +1130,7 @@ disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM o /* If a search pattern is received, remember this pattern, and restart search */ if (pattern[0] != 0) { - strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), 64); + strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), PATH_MAX-1); rewinddir(pdir); } diff --git a/rdpdr.c b/rdpdr.c index c86ce93..33f3fcc 100644 --- a/rdpdr.c +++ b/rdpdr.c @@ -352,7 +352,7 @@ rdpdr_process_irp(STREAM s) error_mode, share_mode, disposition, total_timeout, interval_timeout, flags_and_attributes = 0; - char filename[256]; + char filename[PATH_MAX]; uint8 *buffer, *pst_buf; struct stream out; DEVICE_FNS *fns; diff --git a/types.h b/types.h index 57e6923..2c4625a 100644 --- a/types.h +++ b/types.h @@ -248,13 +248,17 @@ typedef struct notify_data } NOTIFY; +#ifndef PATH_MAX +#define PATH_MAX 256 +#endif + typedef struct fileinfo { uint32 device_id, flags_and_attributes, accessmask; - char path[256]; + char path[PATH_MAX]; DIR *pdir; struct dirent *pdirent; - char pattern[64]; + char pattern[PATH_MAX]; BOOL delete_on_close; NOTIFY notify; uint32 info_class;