diff options
Diffstat (limited to 'doc/examples/tlsauthentication.c')
-rw-r--r-- | doc/examples/tlsauthentication.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c index 4c512a3b..43b41bf1 100644 --- a/doc/examples/tlsauthentication.c +++ b/doc/examples/tlsauthentication.c | |||
@@ -33,12 +33,10 @@ string_to_base64 (const char *message) | |||
33 | char *tmp; | 33 | char *tmp; |
34 | size_t length = strlen (message); | 34 | size_t length = strlen (message); |
35 | 35 | ||
36 | tmp = malloc (length * 2); | 36 | tmp = malloc (length * 2 + 1); |
37 | if (NULL == tmp) | 37 | if (NULL == tmp) |
38 | return tmp; | 38 | return NULL; |
39 | |||
40 | tmp[0] = 0; | 39 | tmp[0] = 0; |
41 | |||
42 | for (i = 0; i < length; i += 3) | 40 | for (i = 0; i < length; i += 3) |
43 | { | 41 | { |
44 | l = (((unsigned long) message[i]) << 16) | 42 | l = (((unsigned long) message[i]) << 16) |
@@ -169,7 +167,7 @@ is_authenticated (struct MHD_Connection *connection, | |||
169 | const char *strbase = "Basic "; | 167 | const char *strbase = "Basic "; |
170 | int authenticated; | 168 | int authenticated; |
171 | size_t slen; | 169 | size_t slen; |
172 | 170 | ||
173 | headervalue = | 171 | headervalue = |
174 | MHD_lookup_connection_value (connection, MHD_HEADER_KIND, | 172 | MHD_lookup_connection_value (connection, MHD_HEADER_KIND, |
175 | "Authorization"); | 173 | "Authorization"); |