Increment p *then* set last full attribute pointer. Fixes #550
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 17 Mar 2014 21:29:59 +0000 (21:29 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 17 Mar 2014 21:30:19 +0000 (21:30 +0000)
src/modules/rlm_rest/rest.c

index c79f704..32648cd 100644 (file)
@@ -518,18 +518,18 @@ static size_t rest_encode_post(void *ptr, size_t size, size_t nmemb, void *userd
 
                if (!--s) goto no_space;
 
-
-               /*
-                *  We wrote one full attribute value pair, record progress.
-                */
-               f = p;
-
                /*
                 *  there are more attributes, insert a separator
                 */
                if (fr_cursor_next(&ctx->cursor)) {
                        *p++ = '&';
                }
+
+               /*
+                *  We wrote one full attribute value pair, record progress.
+                */
+               f = p;
+
                ctx->state = READ_STATE_ATTR_BEGIN;
        }