a93b3655b0
The original patch tried to fix it by not assigning anything to open_mode. That only works if the compiler is able to deduce that bug() will abort the process however (or just not warn about the uninitialized use of open_mode). clang does warn about open_mode being used uninitialized in this function. Solve this by rewriting the function to simply only consider one case, the mode == kVSFSysStrOpenReadOnly one. Otherwise, don't call vsf_sysutil_open_file() and just return -1 after calling bug().
29 lines
853 B
Diff
29 lines
853 B
Diff
diff -ruN vsftpd-3.0.3.orig/sysstr.c vsftpd-3.0.3/sysstr.c
|
|
--- vsftpd-3.0.3.orig/sysstr.c 2020-11-17 09:47:03.872923383 +0100
|
|
+++ vsftpd-3.0.3/sysstr.c 2020-11-17 09:48:41.219754145 +0100
|
|
@@ -74,19 +74,11 @@
|
|
int
|
|
str_open(const struct mystr* p_str, const enum EVSFSysStrOpenMode mode)
|
|
{
|
|
- enum EVSFSysUtilOpenMode open_mode = kVSFSysStrOpenUnknown;
|
|
- switch (mode)
|
|
- {
|
|
- case kVSFSysStrOpenReadOnly:
|
|
- open_mode = kVSFSysUtilOpenReadOnly;
|
|
- break;
|
|
- case kVSFSysStrOpenUnknown:
|
|
- /* Fall through */
|
|
- default:
|
|
- bug("unknown mode value in str_open");
|
|
- break;
|
|
- }
|
|
- return vsf_sysutil_open_file(str_getbuf(p_str), open_mode);
|
|
+ if (mode == kVSFSysStrOpenReadOnly)
|
|
+ return vsf_sysutil_open_file(str_getbuf(p_str), kVSFSysUtilOpenReadOnly);
|
|
+
|
|
+ bug("unknown mode value in str_open");
|
|
+ return -1;
|
|
}
|
|
|
|
int
|