Commit 262d0522 authored by Ian Goldberg's avatar Ian Goldberg

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@bitfehler.net> for the
report and the patch.
parent 23178481
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@bitfehler.net> for the report and
the patch.
2013-08-21
* src/proto.c: Fix warning from clang in proto.c. Before, trying
......
......@@ -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':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment