masqmail

diff src/smtp_out.c @ 312:c74adb7c4f50

null-terminated the decoded base64 strings The returned size is still the same. I only alloced one byte more and filled it with zero. TODO: I'm not sure if the allocated size is exact. It's large enough but maybe too large.
author meillo@marmaro.de
date Sun, 24 Apr 2011 20:13:47 +0200
parents 4cff8638dd9b
children 412385b57dc4
line diff
     1.1 --- a/src/smtp_out.c	Sun Apr 24 19:37:56 2011 +0200
     1.2 +++ b/src/smtp_out.c	Sun Apr 24 20:13:47 2011 +0200
     1.3 @@ -628,10 +628,10 @@
     1.4  
     1.5  			DEBUG(5) debugf("smtp_out_auth_login():\n");
     1.6  			resp64 = get_response_arg(&(psb->buffer[4]));
     1.7 -			DEBUG(5) debugf("  encoded response = %s\n", resp64);
     1.8 +			DEBUG(5) debugf("  encoded response = `%s'\n", resp64);
     1.9  			resp = base64_decode(resp64, &resp_size);
    1.10  			g_free(resp64);
    1.11 -			DEBUG(5) debugf("  decoded response = %s, size = %d\n", resp, resp_size);
    1.12 +			DEBUG(5) debugf("  decoded response = `%s', size = %d\n", resp, resp_size);
    1.13  			g_free(resp);
    1.14  			reply64 = base64_encode(psb->auth_login, strlen(psb->auth_login));
    1.15  			fprintf(psb->out, "%s\r\n", reply64);
    1.16 @@ -641,10 +641,10 @@
    1.17  			if ((ok = read_response(psb, SMTP_CMD_TIMEOUT))) {
    1.18  				if ((ok = check_response(psb, TRUE))) {
    1.19  					resp64 = get_response_arg(&(psb->buffer[4]));
    1.20 -					DEBUG(5) debugf("  encoded response = %s\n", resp64);
    1.21 +					DEBUG(5) debugf("  encoded response = `%s'\n", resp64);
    1.22  					resp = base64_decode(resp64, &resp_size);
    1.23  					g_free(resp64);
    1.24 -					DEBUG(5) debugf("  decoded response = %s, size = %d\n", resp, resp_size);
    1.25 +					DEBUG(5) debugf("  decoded response = `%s', size = %d\n", resp, resp_size);
    1.26  					g_free(resp);
    1.27  					reply64 = base64_encode(psb->auth_secret, strlen(psb->auth_secret));
    1.28  					fprintf(psb->out, "%s\r\n", reply64);