[Pkg-privacy-commits] [libotr] 127/225: Avoid crash even if otrl_proto_query_bestversion is misused

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository libotr.

commit 262d0522dea091b9065392563a5a2cd93e7fb17b
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date:   Sun Oct 13 08:43:49 2013 -0400

    Avoid crash even if otrl_proto_query_bestversion is misused
    
    Return 0 instead of crashing from otrl_proto_query_bestversion if passed
    an illegal input.  Thanks to Conrad Hoffmann <ch at bitfehler.net> for the
    report and the patch.
---
 ChangeLog   | 7 +++++++
 src/proto.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7488afd..138faaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-13
+
+	* src/proto.c: Return 0 instead of crashing from
+	otrl_proto_query_bestversion if passed an illegal input.
+	Thanks to Conrad Hoffmann <ch at bitfehler.net> for the report and
+	the patch.
+
 2013-08-21
 
 	* src/proto.c: Fix warning from clang in proto.c. Before, trying
diff --git a/src/proto.c b/src/proto.c
index ce597a2..c2dd24a 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -294,13 +294,16 @@ unsigned int otrl_proto_query_bestversion(const char *otrquerymsg,
 
 
     otrtag = strstr(otrquerymsg, "?OTR");
+    if (!otrtag) {
+	return 0;
+    }
     otrtag += 4;
 
-    if (otrtag && *otrtag == '?') {
+    if (*otrtag == '?') {
 	query_versions = (1<<0);
 	++otrtag;
     }
-    if (otrtag && *otrtag == 'v') {
+    if (*otrtag == 'v') {
 	for(++otrtag; *otrtag && *otrtag != '?'; ++otrtag) {
 	    switch(*otrtag) {
 		case '2':

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git



More information about the Pkg-privacy-commits mailing list