[gnome-online-accounts/gnome-3-14] inquiry: fix edge case when answer is full size of reply buffer



commit fff39765db78695aeb86c2be894f64e014471d11
Author: Ray Strode <rstrode redhat com>
Date:   Tue Nov 4 09:48:49 2014 -0500

    inquiry: fix edge case when answer is full size of reply buffer
    
    Right now if the user's answer is 1024 bytes exactly then we'll
    call strlen() on an unterminated string.
    
    This commit addresses the issue by avoiding the strlen() call and
    instead using the already computed length.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739593

 src/goaidentity/goakerberosidentityinquiry.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/src/goaidentity/goakerberosidentityinquiry.c b/src/goaidentity/goakerberosidentityinquiry.c
index f900197..7c9a84a 100644
--- a/src/goaidentity/goakerberosidentityinquiry.c
+++ b/src/goaidentity/goakerberosidentityinquiry.c
@@ -296,8 +296,7 @@ goa_kerberos_identity_inquiry_answer_query (GoaIdentityInquiry * inquiry,
     {
       strncpy (kerberos_query->kerberos_prompt->reply->data,
                answer, kerberos_query->kerberos_prompt->reply->length);
-      kerberos_query->kerberos_prompt->reply->length =
-        (unsigned int) strlen (kerberos_query->kerberos_prompt->reply->data);
+      kerberos_query->kerberos_prompt->reply->length = (unsigned int) answer_length;
 
       goa_kerberos_identity_inquiry_mark_query_answered (self, kerberos_query);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]