Discussion:
[Ipmitool-devel] [PATCH] Fix bug in plugins/lan/lan.c introduced in CVS revision 1.70.
Dan Gora
2013-04-18 20:47:10 UTC
Permalink
Hi All,

This patch fixes a bug introduced in CVS revision 1.70 of src/plugins/lan/lan.c.

Looks like someone forgot to put in braces around the 'if'.

thanks
dan

From: Dan Gora <***@adax.com>
Date: Thu, 18 Apr 2013 17:38:45 -0300
Subject: [PATCH] Fix bug in plugins/lan/lan.c introduced in CVS revision
1.70.

Fixed a bug where connecting to a remote shelf manager via the lan
interface would always fail with:

Activate Session error: Session sequence out of range Error: Unable
to establish LAN session

This is due to a bug introduced in get_random() where braces were
missing from an error check.
---
ipmitool/src/plugins/lan/lan.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ipmitool/src/plugins/lan/lan.c b/ipmitool/src/plugins/lan/lan.c
index d371151..b107730 100644
--- a/ipmitool/src/plugins/lan/lan.c
+++ b/ipmitool/src/plugins/lan/lan.c
@@ -208,9 +208,10 @@ get_random(void *data, int len)

if (fd < 0)
return errno;
- if (len < 0)
+ if (len < 0) {
close(fd);
return errno; /* XXX: ORLY? */
+ }

rv = read(fd, data, len);

Loading...