- uschar *last_sub_start = str;
- int n;
-
- for (n = 0; n < nptrs; n++)
- ptrs[n] = NULL;
- n = 1;
-
- while (*str) {
- if (*str == '\t') {
- if (n <= nptrs) {
- *ptrs++ = last_sub_start;
- last_sub_start = str + 1;
- *str = '\0';
- }
- n++;
- }
- str++;
- }
-
- /* It's acceptable for the string to end with a tab character. We see
- this in AUTH PLAIN without an initial response from the client, which
- causing us to send "334 " and get the data from the client. */
- if (n <= nptrs) {
- *ptrs = last_sub_start;
- } else {
- HDEBUG(D_auth) debug_printf("dovecot: warning: too many results from tab-splitting; saw %d fields, room for %d\n", n, nptrs);
- n = nptrs;
- }
-
- return n <= nptrs ? n : nptrs;
+uschar *last_sub_start = str;
+int n;
+
+for (n = 0; n < nptrs; n++)
+ ptrs[n] = NULL;
+n = 1;
+
+while (*str)
+ if (*str++ == '\t')
+ if (n++ <= nptrs)
+ {
+ *ptrs++ = last_sub_start;
+ last_sub_start = str;
+ str[-1] = '\0';
+ }
+
+/* It's acceptable for the string to end with a tab character. We see
+this in AUTH PLAIN without an initial response from the client, which
+causing us to send "334 " and get the data from the client. */
+if (n <= nptrs)
+ *ptrs = last_sub_start;
+else
+ {
+ HDEBUG(D_auth)
+ debug_printf("dovecot: warning: too many results from tab-splitting;"
+ " saw %d fields, room for %d\n", n, nptrs);
+ n = nptrs;
+ }
+
+return n <= nptrs ? n : nptrs;