aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2005-08-27 18:28:55 +0000
committerNils Durner <durner@gnunet.org>2005-08-27 18:28:55 +0000
commita069ee520ab1e7f6725192c3d453ff8b5397e9c5 (patch)
tree83444d9c2869664036b791dc40ef9d51f0ed43b6
parent5b6a929fe95f5d58e380fa635fd1f7dc15319dd4 (diff)
downloadgnunet-gtk-a069ee520ab1e7f6725192c3d453ff8b5397e9c5.tar.gz
gnunet-gtk-a069ee520ab1e7f6725192c3d453ff8b5397e9c5.zip
- don't exceed MAX_PATH under Windows
-rw-r--r--src/plugins/fs/download.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index 36cc5d65..2fd3e2b9 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -199,9 +199,25 @@ static void initiateDownload(GtkTreeModel * model,
199 DIR_SEPARATOR_STR); 199 DIR_SEPARATOR_STR);
200 strcat(pfx, 200 strcat(pfx,
201 name); 201 name);
202#ifndef WINDOWS
202 strcat(lnk, 203 strcat(lnk,
203 &filename[strlen(ECRS_URI_PREFIX) + 204 &filename[strlen(ECRS_URI_PREFIX) +
204 strlen(ECRS_FILE_INFIX)]); 205 strlen(ECRS_FILE_INFIX)]);
206#else
207 {
208 /* Do not exceed MAX_PATH under Windows */
209
210 int fnlen = MAX_PATH - strlen(lnk) - 4; /* 4 = ".lnk"*/
211 if (fnlen < 4) {
212 BREAK();
213 return;
214 }
215
216 strncat(lnk,
217 &filename[strlen(ECRS_URI_PREFIX) +
218 strlen(ECRS_FILE_INFIX)], fnlen);
219 }
220#endif
205 if (0 != STAT(pfx, 221 if (0 != STAT(pfx,
206 &sbuf)) { 222 &sbuf)) {
207 if (0 != SYMLINK(lnk, pfx)) 223 if (0 != SYMLINK(lnk, pfx))
@@ -371,14 +387,13 @@ void displayDownloadComplete(const struct ECRS_URI * uri,
371 387
372 ren = ECRS_suggestFilename(ln); 388 ren = ECRS_suggestFilename(ln);
373 newFn = strrchr(ren ? ren : ln, DIR_SEPARATOR) + 1; 389 newFn = strrchr(ren ? ren : ln, DIR_SEPARATOR) + 1;
374 dstPath = getConfigurationString("FS", "INCOMINGDIR"); 390
375 if (!dstPath) { 391 dstPath = getFileName("FS",
376 LOG(LOG_ERROR, 392 "INCOMINGDIR",
377 _("You must specify a directory in the configuration" 393 _("You must specify a directory in the configuration"
378 " in section `%s' under `%s'.\n"), "FS", "INCOMINGDIR"); 394 " in section `%s' under `%s'."));
379 395 if (!dstPath)
380 return; 396 return;
381 }
382 mkdirp(dstPath); 397 mkdirp(dstPath);
383 398
384 dstFile = MALLOC(strlen(dstPath) + strlen(newFn) + 2); 399 dstFile = MALLOC(strlen(dstPath) + strlen(newFn) + 2);