WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenpmd: Fix bogus fgets() size parameter.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 Dec 2008 22:31:07 -0800
Delivery-date: Tue, 16 Dec 2008 22:32:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xenpmd: Fix bogus fgets() size parameter., Xen patchbot-unstable <=