* [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access.
@ 2011-01-21 20:32 Cristian Greco
2011-01-21 21:14 ` Garrett Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Cristian Greco @ 2011-01-21 20:32 UTC (permalink / raw)
To: ltp-list
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access.
2011-01-21 20:32 [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access Cristian Greco
@ 2011-01-21 21:14 ` Garrett Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Garrett Cooper @ 2011-01-21 21:14 UTC (permalink / raw)
To: Cristian Greco; +Cc: ltp-list
On Fri, Jan 21, 2011 at 12:32 PM, Cristian Greco <cristian@regolo.cc> wrote:
> Hi,
>
> this should fix an out-of-bounds access by removing the useless
> variable.
snprintf would be better.
Thanks,
-Garrett
------------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-21 21:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-21 20:32 [LTP] [PATCH] Remove misused variable: fixes an array out-of-bounds access Cristian Greco
2011-01-21 21:14 ` Garrett Cooper
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.