[phodav] chezdav: handle line \n ending..



commit 50fd205b8525d63d4d4da75377d9a2f389cbef67
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Wed Jan 22 19:06:23 2014 +0100

    chezdav: handle line \n ending..

 libphodav/chezdav.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libphodav/chezdav.c b/libphodav/chezdav.c
index f13c115..8b86317 100644
--- a/libphodav/chezdav.c
+++ b/libphodav/chezdav.c
@@ -163,11 +163,15 @@ digest_auth_callback (SoupAuthDomain *auth_domain, SoupMessage *msg,
                       const char *username, gpointer data)
 {
   gchar *digest = NULL;;
-  gchar *line;
+  gchar *line = NULL;
+  gchar *eol = NULL;
 
-  for (line = htdigest; line && *line; line = strchr (line, '\n'))
+  for (line = htdigest; line && *line; line = eol ? eol + 1 : NULL)
     {
       gchar **strv = g_strsplit (line, ":", -1);
+      eol = strchr (line, '\n');
+      if (eol)
+        *eol = '\0';
 
       if (!(strv[0] && strv[1] && strv[2])) {
         g_warn_if_reached ();


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