Package: pure-ftpd
Version: 1.0.21
Severity: wishlist

we found a small problem on a fast multiprocessor system on heavy load. As we are directly accessing the upload fifo (not using the upload script), we have our own processes reading directly from the pipe. There are three 'safe_write' calls in function 'upload_pipe_push' in file 'upload-pipe.c' to signal a single new file. Thus the write and the consecutive read(s) are no longer atomic which can cause incomplete reads and - with more than one reader - a glorious mess.

It should be fairly simple to build the complete string on the stack and just use a single write instead of the three.

Current code looks like:

    (void) safe_write( upload_pipe_fd, &starter, (size_t) 1U );
    (void) safe_write( upload_pipe_fd, vuser, strlen(vuser) );
    (void) safe_write( upload_pipe_fd, file, strlen(file) + (size_t) 1U );

and should be changed to something like:

    char cUploadString[MAX_PATH+MAX_USER_LENGTH+4];
snprintf( cUploadString, MAX_PATH+MAX_USER_LENGTH+3, "%c%s%s", starter, vuser, file ); safe_write( upload_pipe_fd, cUploadString, strlen(cUploadString) + (size_t) 1U );

Cheers,
Fritz


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to