*numwritten = 0;
- while (*out != '\0') {
+ while (outl > 0) {
size_t i;
char c;
}
/* Now, go look for the next LF, or the end of the string */
- for (i = 0; (c = out[i]) != '\n' && c != '\0'; i++)
+ for (i = 0, c = '\0'; i < outl && (c = out[i]) != '\n'; i++)
continue;
if (c == '\n')
i++;
if (!BIO_write_ex(BIO_next(b), out, i, &num))
return 0;
out += num;
+ outl -= num;
*numwritten += num;
i -= num;
}