summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch
blob: 0efdc59fc68520c8eb71b05c5d53d7af38028516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Fix NULL pointer crash.

Before use usbbuslist, we should check if it is valid.

Upstream-Status: Pending
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 lsusb-t.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lsusb-t.c b/lsusb-t.c
index f604155..583a46a 100644
--- a/lsusb-t.c
+++ b/lsusb-t.c
@@ -643,6 +643,10 @@ static void sort_busses(void)
 	/* need to reverse sort bus numbers */
 	struct usbbusnode *t, *p, **pp;
 	int swapped;
+
+	if (!usbbuslist)
+		return;
+
 	do {
 		p = usbbuslist;
 		pp = &usbbuslist;
-- 
1.7.4.1