diff options
Diffstat (limited to 'mail-client/mhng/files')
-rw-r--r-- | mail-client/mhng/files/mhng-0.0.2-fgets_return.patch | 37 | ||||
-rw-r--r-- | mail-client/mhng/files/mhng-0.0.2-system_return.patch | 25 | ||||
-rw-r--r-- | mail-client/mhng/files/mhng-0.0.2-write_return.patch | 25 |
3 files changed, 87 insertions, 0 deletions
diff --git a/mail-client/mhng/files/mhng-0.0.2-fgets_return.patch b/mail-client/mhng/files/mhng-0.0.2-fgets_return.patch new file mode 100644 index 0000000..d1b4d8c --- /dev/null +++ b/mail-client/mhng/files/mhng-0.0.2-fgets_return.patch @@ -0,0 +1,37 @@ +commit d1d5f1c46aebf480af7c46d64b3fc0f75814946d +Author: Palmer Dabbelt <palmer@dabbelt.com> +Date: Fri Dec 5 15:47:25 2014 -0800 + + Check that the username/password files aren't empty + + This would have caused a bit of undefined behavior due to some + uninitialized stack buffers. + +diff --git a/src/libmhng/mailbox.c++ b/src/libmhng/mailbox.c++ +index a21f9ab..794a74b 100644 +--- a/src/libmhng/mailbox.c++ ++++ b/src/libmhng/mailbox.c++ +@@ -195,7 +195,10 @@ std::string mailbox::username(void) const + } + + char line[BUFFER_SIZE]; +- fgets(line, BUFFER_SIZE, file); ++ if (fgets(line, BUFFER_SIZE, file) == NULL) { ++ fprintf(stderr, "Empty username file\n"); ++ abort(); ++ } + while (isspace(line[strlen(line)-1])) + line[strlen(line)-1] = '\0'; + +@@ -218,7 +221,10 @@ std::string mailbox::password(void) const + } + + char line[BUFFER_SIZE]; +- fgets(line, BUFFER_SIZE, file); ++ if (fgets(line, BUFFER_SIZE, file) == NULL) { ++ fprintf(stderr, "Empty password file\n"); ++ abort(); ++ } + while (isspace(line[strlen(line)-1])) + line[strlen(line)-1] = '\0'; + diff --git a/mail-client/mhng/files/mhng-0.0.2-system_return.patch b/mail-client/mhng/files/mhng-0.0.2-system_return.patch new file mode 100644 index 0000000..d140e33 --- /dev/null +++ b/mail-client/mhng/files/mhng-0.0.2-system_return.patch @@ -0,0 +1,25 @@ +commit 1f34560136cfec61b56cc069ac5516510d292902 +Author: Palmer Dabbelt <palmer@dabbelt.com> +Date: Fri Dec 5 15:50:00 2014 -0800 + + Check the return code of system() in mhng-urls + + This isn't so interesting because we're just opening a web browser, + but I guess it's a tiny bit safer -- note that all I do here is print + a stderr message... + +diff --git a/src/mhng-urls.c++ b/src/mhng-urls.c++ +index a809e76..c364512 100644 +--- a/src/mhng-urls.c++ ++++ b/src/mhng-urls.c++ +@@ -70,7 +70,9 @@ int main(int argc, const char **argv) + getenv("BROWSER"), + url.c_str() + ); +- system(command); ++ if (system(command) != 0) ++ fprintf(stderr, "command '%s' failed\n", ++ command); + } + } + if (args->numbers().size() != 0) diff --git a/mail-client/mhng/files/mhng-0.0.2-write_return.patch b/mail-client/mhng/files/mhng-0.0.2-write_return.patch new file mode 100644 index 0000000..9e06ea5 --- /dev/null +++ b/mail-client/mhng/files/mhng-0.0.2-write_return.patch @@ -0,0 +1,25 @@ +commit 012e86cc6f1744c6e712737a496abfdb62786433 +Author: Palmer Dabbelt <palmer@dabbelt.com> +Date: Fri Dec 5 15:45:19 2014 -0800 + + Always check write()'s return value + + Even if a write() of 1 can't fail here, I guess I still need to check + it... + +diff --git a/src/libmhng/mime/part.c++ b/src/libmhng/mime/part.c++ +index 268dfa5..4dfbc45 100644 +--- a/src/libmhng/mime/part.c++ ++++ b/src/libmhng/mime/part.c++ +@@ -316,7 +316,10 @@ std::vector<std::string> mime::part::utf8(void) const + written += wout; + } + +- ::write(outfd, "\n", 1); ++ if (::write(outfd, "\n", 1) != 1) { ++ fprintf(stderr, "write of 1 failed\n"); ++ abort(); ++ } + } + + close(outfd); |