SHA256
1
0
forked from pool/libical
libical/0002-vcc.y-fix-infinite-loop-with-lower-case-hex-digits.patch

47 lines
1.3 KiB
Diff
Raw Normal View History

From bf83a0d664f46229836852f5b41539c263c3b921 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 17 Sep 2018 16:36:36 +0200
Subject: [PATCH 2/5] vcc.y - fix infinite loop with lower-case hex digits
References: https://github.com/libical/libical/pull/354
When lower-case hex digits are used in a quoted-printable-encoded
character, an infinite loop would occur in the vcard parser.
"N;ENCODING=QUOTED-PRINTABLE:=c3=a4=c3=b6;=c3=bC=c3=9f\n"
References: #353
---
src/libicalvcal/vcc.c | 2 ++
src/libicalvcal/vcc.y | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/libicalvcal/vcc.c b/src/libicalvcal/vcc.c
index c2a743c2..29354df4 100644
--- a/src/libicalvcal/vcc.c
+++ b/src/libicalvcal/vcc.c
@@ -1132,6 +1132,8 @@ static int hexdigit_decode(char c)
return c - '0';
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
return -1;
}
diff --git a/src/libicalvcal/vcc.y b/src/libicalvcal/vcc.y
index 45243df6..a052e9a2 100644
--- a/src/libicalvcal/vcc.y
+++ b/src/libicalvcal/vcc.y
@@ -953,6 +953,8 @@ static int hexdigit_decode(char c)
return c - '0';
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
return -1;
}
--
2.19.1