[PATCH] isdn: eicon: fix a missing check of api_parse
From: Kangjie Lu
Date: Wed Dec 26 2018 - 01:41:12 EST
api_parse can fail, and if it fails, we should not use the ss_parms
which can be incorrect.
The fix checks its return value and stops using ss_parms if api_parse
fails.
Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
---
drivers/isdn/hardware/eicon/message.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index def7992a38e6..afb4a7d88288 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1846,7 +1846,13 @@ static byte facility_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
break;
case S_HOLD:
- api_parse(&parms->info[1], (word)parms->length, "ws", ss_parms);
+ if (api_parse(&parms->info[1],
+ (word)parms->length,
+ "ws", ss_parms)) {
+ dbug(1, dprintf("format wrong"));
+ Info = _WRONG_MESSAGE_FORMAT;
+ break;
+ }
if (plci && plci->State && plci->SuppState == IDLE)
{
plci->SuppState = HOLD_REQUEST;
--
2.17.2 (Apple Git-113)