[Patch] Fix buffer overflow and missing include

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

attached is a trivial patch fixing the following issues:

- libbalsa/folder-scanners.c: fix missing include on old systems which do not indirectly import string.h, remove obsolete macro
- libbalsa/libbalsa.c: fix one-byte buffer overflow in x509_fingerprint()

Best,
Albrecht.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
fix_overflow_missing_inc.diff (text/x-patch, 1.1 KB)
diff --git a/libbalsa/folder-scanners.c b/libbalsa/folder-scanners.c
index 634af73ce..a3e703725 100644
--- a/libbalsa/folder-scanners.c
+++ b/libbalsa/folder-scanners.c
@@ -22,6 +22,7 @@
 #endif                          /* HAVE_CONFIG_H */
 #include "folder-scanners.h"
 
+#include <string.h>
 #include <glib/gstdio.h>
 
 #include "libbalsa.h"
@@ -30,10 +31,6 @@
 #include "imap-commands.h"
 #include "imap-server.h"
 
-#ifndef PATH_MAX
-#define PATH_MAX _POSIX_PATH_MAX
-#endif
-
 typedef void (*local_scanner_helper) (gpointer rnode,
                                       const gchar * prefix,
                                       LocalCheck check_local_path,
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 090a0fcff..a93826658 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -525,7 +525,7 @@ x509_fingerprint(gnutls_x509_crt_t cert)
 
     buf_size = 20U;
     g_message("%d", gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_SHA1, sha1_buf, &buf_size));
-    str_buf = g_malloc0(60U);
+    str_buf = g_malloc0(61U);
     for (n = 0; n < 20; n++) {
     	sprintf(&str_buf[3 * n], "%02x:", sha1_buf[n]);
     }
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlwXrkYACgkQTKlvDmfn
2fjrbQgAmgIOyQDW/uQElfEVFtid2Oaok9aaFcn+vxQF/zaqtnEHqd6ay8z2t6gM
E27DlpFTW2v9fW5cWnL/6Z697PptfmsnFcc7u0SzWMS0XiTGOcIlHe/sO6GfmFUy
6/lq0m6MMeJs9XxOafRQvyWKUADmEOk7RR2lD5VJ5pnV/N4Xy9NLVLpSXMGGQ4Zw
mmwZAK7n1j4+c4/EA4UgolxJx7PhwnMVpeFH2S8Pri1/5O+DbTBWX2KcnhYQpvT/
jJtnopuqXJXhGyCfJ/qKicx4dn4igF3u8eCWZ+aZYmg2oCqV273kE6g1Z9QQEXmM
1KEe5D094DaUDeHd114nddoqAun7wg==
=zzVg
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.