Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor fixes

  • Loading branch information...
commit c83e3b5fb23bb06f710b894d26f1a650c93fa22f 1 parent 35a8f06
@bjin bjin authored
Showing with 17 additions and 7 deletions.
  1. +1 −1  base64.h
  2. +14 −5 http-auth.c
  3. +2 −1  http-auth.h
View
2  base64.h
@@ -40,7 +40,7 @@ int base64_decode(uint8_t *out, const char *in, int out_size);
*
* @param out buffer for encoded data
* @param out_size size in bytes of the output buffer, must be at
- * least AV_BASE64_SIZE(in_size)
+ * least BASE64_SIZE(in_size)
* @param in_size size in bytes of the 'in' buffer
* @return 'out' or NULL in case of error
*/
View
19 http-auth.c
@@ -162,7 +162,8 @@ static int extract_param(const char **source, param_token *name, param_token *va
}
-char* digest_authentication_encode(const char *line, const char *user, const char *passwd, const char *method, const char *path, int count, const char *cnonce)
+char* digest_authentication_encode(const char *line, const char *user, const char *passwd,
+ const char *method, const char *path, int count, const char *cnonce)
{
char *realm = NULL, *opaque = NULL, *nonce = NULL, *qop = NULL;
char nc[9];
@@ -175,14 +176,22 @@ char* digest_authentication_encode(const char *line, const char *user, const cha
int namelen = name.e - name.b;
int valuelen = value.e - value.b;
- if (strncmp_nocase(name.b, "realm" , namelen) == 0)
+ if (strncmp_nocase(name.b, "realm" , namelen) == 0) {
strncpy(realm = (char *)malloc(valuelen + 1), value.b, valuelen);
- if (strncmp_nocase(name.b, "opaque", namelen) == 0)
+ realm[valuelen] = '\0';
+ }
+ if (strncmp_nocase(name.b, "opaque", namelen) == 0) {
strncpy(opaque = (char *)malloc(valuelen + 1), value.b, valuelen);
- if (strncmp_nocase(name.b, "nonce" , namelen) == 0)
+ opaque[valuelen] = '\0';
+ }
+ if (strncmp_nocase(name.b, "nonce" , namelen) == 0) {
strncpy(nonce = (char *)malloc(valuelen + 1), value.b, valuelen);
- if (strncmp_nocase(name.b, "qop" , namelen) == 0)
+ nonce[valuelen] = '\0';
+ }
+ if (strncmp_nocase(name.b, "qop" , namelen) == 0) {
strncpy(qop = (char *)malloc(valuelen + 1), value.b, valuelen);
+ qop[valuelen] = '\0';
+ }
}
if (!realm || !nonce || !user || !passwd || !path || !method) {
View
3  http-auth.h
@@ -19,6 +19,7 @@ char* basic_authentication_encode(const char *user, const char *passwd);
* only md5 method is available, see RFC 2617 for detail.
*
*/
-char* digest_authentication_encode(const char *line, const char *user, const char *passwd, const char *method, const char *path, int count, const char *cnonce);
+char* digest_authentication_encode(const char *line, const char *user, const char *passwd,
+ const char *method, const char *path, int count, const char *cnonce);
#endif /* HTTP_AUTH_H */
Please sign in to comment.
Something went wrong with that request. Please try again.