All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Greco <cristian@regolo.cc>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access.
Date: Fri, 21 Jan 2011 21:32:43 +0100	[thread overview]
Message-ID: <20110121213243.68c293fc@regolo> (raw)

Hi,

this should fix an out-of-bounds access by removing the useless
variable.


Signed-off-by: Cristian Greco <cristian@regolo.cc>
---
 testcases/kernel/fs/inode/inode02.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/fs/inode/inode02.c b/testcases/kernel/fs/inode/inode02.c
index 8566c9a..05d5c7a 100644
--- a/testcases/kernel/fs/inode/inode02.c
+++ b/testcases/kernel/fs/inode/inode02.c
@@ -80,7 +80,6 @@ int  nchild;
 FILE *list_stream=NULL;
 int  list_id;
 int  file_id;
-char slash[1];
 
 int increment_name(), get_next_name(), mode(), escrivez(), massmurder();
 int max_depth, max_breadth, file_length;
@@ -249,9 +248,6 @@ int tree()
 	int len;
 	int status;
 
-	slash[0] = '/';
-	slash[1] = '\0';
-
 	/********************************/
 	/*				*/
 	/*  make the root directory for */
@@ -285,8 +281,7 @@ int tree()
 	/****************************************/
 
 	strcpy(path_list_string, path_string);
-	strcat(path_list_string, slash);
-	strcat(path_list_string, "path_list");
+	strcat(path_list_string, "/path_list");
 	list_id = creat(path_list_string, FILE_MODE);
 	if (list_id == -1) {
 		fprintf(temp,"\nThe path_list file '%s' cannot be created, errno=%d\n",
@@ -423,7 +418,7 @@ int level;    	/* the tree depth variable */
 		for (i = 0; i <= max_breadth; i++) {
 			get_next_name();
 			strcpy(new_string, string);
-			strcat(new_string, slash);
+			strcat(new_string, "/");
 			strcat(new_string, name);
 
 			/****************************************/
@@ -900,4 +895,4 @@ instress()
         tst_resm(TINFO, "System resource may be too low, fork() malloc()"
                                 " etc are likely to fail.\n");
         return 1;
-}
\ No newline at end of file
+}
-- 
1.7.2.3


Thanks,
--
Cristian Greco
GPG key ID: 0xCF4D32E4

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2011-01-21 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 20:32 Cristian Greco [this message]
2011-01-21 21:14 ` [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access Garrett Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110121213243.68c293fc@regolo \
    --to=cristian@regolo.cc \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.