Skip to content
Snippets Groups Projects
Commit bb1ee459 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix segfault reported with ftpalias.cfg support in some cases

ftpalias() can return true even when the directory is not set to a valid
directory index (i.e. set to -1), so using as an array index would definitely
segfault. Part of commit 8ad30b6c by Deuce 3 years ago.

I didn't test this as I'm not sure exactly the combination of ftpalias.cfg
content and FTP command received that would trigger this, but it's most
definitely a bug.

So should fix the segfault reported in issue #288.
parent aac64b96
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2415 passed
......@@ -1599,7 +1599,7 @@ static int parsepath(char** pp, user_t* user, client_t* client, int* curlib, int
tmp = strchr(filename, '/');
if (tmp != NULL)
*tmp = 0;
if (ftpalias(filename, filename, user, client, &dir) == TRUE) {
if (ftpalias(filename, filename, user, client, &dir) == TRUE && dir >= 0) {
lib = scfg.dir[dir]->lib;
if (strchr(p, '/') != NULL) {
p = strchr(p, '/');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment