netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libiptc: fix fortify errors in debug code
@ 2015-08-20 11:12 Mike Frysinger
  2015-08-26 19:09 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2015-08-20 11:12 UTC (permalink / raw)
  To: netfilter-devel

When using open(O_CREAT), you must supply the mode bits, otherwise the
func will pull random garbage off the stack.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 libiptc/libiptc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index f0f7815..9c07bb4 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -1357,7 +1357,7 @@ retry:
 #ifdef IPTC_DEBUG2
 	{
 		int fd = open("/tmp/libiptc-so_get_entries.blob",
-				O_CREAT|O_WRONLY);
+				O_CREAT|O_WRONLY, 0644);
 		if (fd >= 0) {
 			write(fd, h->entries, tmp);
 			close(fd);
@@ -2588,7 +2588,7 @@ TC_COMMIT(struct xtc_handle *handle)
 #ifdef IPTC_DEBUG2
 	{
 		int fd = open("/tmp/libiptc-so_set_replace.blob",
-				O_CREAT|O_WRONLY);
+				O_CREAT|O_WRONLY, 0644);
 		if (fd >= 0) {
 			write(fd, repl, sizeof(*repl) + repl->size);
 			close(fd);
@@ -2664,7 +2664,7 @@ TC_COMMIT(struct xtc_handle *handle)
 #ifdef IPTC_DEBUG2
 	{
 		int fd = open("/tmp/libiptc-so_set_add_counters.blob",
-				O_CREAT|O_WRONLY);
+				O_CREAT|O_WRONLY, 0644);
 		if (fd >= 0) {
 			write(fd, newcounters, counterlen);
 			close(fd);
-- 
2.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libiptc: fix fortify errors in debug code
  2015-08-20 11:12 [PATCH] libiptc: fix fortify errors in debug code Mike Frysinger
@ 2015-08-26 19:09 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2015-08-26 19:09 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: netfilter-devel

On Thu, Aug 20, 2015 at 07:12:59AM -0400, Mike Frysinger wrote:
> When using open(O_CREAT), you must supply the mode bits, otherwise the
> func will pull random garbage off the stack.

Also applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-26 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 11:12 [PATCH] libiptc: fix fortify errors in debug code Mike Frysinger
2015-08-26 19:09 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).