aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-04-21 23:20:18 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-04-21 23:20:18 +0200
commit71be565cf48f17b21eebbcde1ddba27c6e06d4c5 (patch)
tree005a3a534fa12ae8a7cc6b8955d7809df38c6bde /src
parent81512cc02b92c2d6deaf9461617c89d49f44310f (diff)
curl: -O crash on windows
The -O option caused curl to crash on windows and DOS due to the tool writing out of boundary memory.
Diffstat (limited to 'src')
-rw-r--r--src/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index b7e438b1e..2dd6dc873 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5839,7 +5839,8 @@ rename_if_dos_device_name (char *file_name)
static char *sanitize_dos_name(char *fn)
{
char tmpfn[PATH_MAX];
- fn[PATH_MAX-1]=0; /* ensure fn is not too long by possibly truncating it */
+ if(strlen(fn) >= PATH_MAX)
+ fn[PATH_MAX-1]=0; /* truncate it */
strcpy(tmpfn, msdosify(fn));
free(fn);
return strdup(rename_if_dos_device_name(tmpfn));