Remove misused variable: fixes an array out-of-bounds access.
PATCH 1/1 Remove misused variable: fixes an array out-of-bounds access.
Hi,
this should fix an out-of-bounds access by removing the useless variable.
--- testcases/kernel/fs/inode/inode02.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
testcases/kernel/fs/inode/inode02.c +3 -8
@@ -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 ; -} +}
Signature · 18 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 4 lines · Cristian Greco
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list