[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenpmd: Fix bogus fgets() size parameter.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1229190260 0
# Node ID 045f70d1acdb3adbf6c8fd6132b02228867c9258
# Parent  6a3c2b4459ade54bb860d36b7566b182f4ec1cf9
xenpmd: Fix bogus fgets() size parameter.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/xenpmd/xenpmd.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)

diff -r 6a3c2b4459ad -r 045f70d1acdb tools/xenpmd/xenpmd.c
--- a/tools/xenpmd/xenpmd.c     Sat Dec 13 15:56:16 2008 +0000
+++ b/tools/xenpmd/xenpmd.c     Sat Dec 13 17:44:20 2008 +0000
@@ -297,7 +297,6 @@ int get_next_battery_info_or_status(DIR 
     if  ( !info_or_status )
         return 0;
 
-    memset(line_info, 0, 256);
     if (type == BIF) 
         memset(info_or_status, 0, sizeof(struct battery_info));
     else 
@@ -307,11 +306,8 @@ int get_next_battery_info_or_status(DIR 
     if ( !file )
         return 0;
 
-    while ( fgets(line_info, 1024, file) != NULL ) 
-    {
+    while ( fgets(line_info, sizeof(line_info), file) != NULL ) 
         parse_battery_info_or_status(line_info, type, info_or_status);
-        memset(line_info, 0, 256);
-    }
 
     fclose(file);
     return 1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.