]> mj.ucw.cz Git - libucw.git/commitdiff
FBSocket: Fix possible crashes when switching read/write with bflush().
authorMilan Rusek <mrusek@ucw.cz>
Mon, 12 Feb 2024 14:26:44 +0000 (15:26 +0100)
committerPavel Charvat <pchar@ucw.cz>
Mon, 12 Feb 2024 15:36:43 +0000 (15:36 +0000)
ucw/fb-socket.c

index 19f27bd52130b480a40f4b0418794958d0e14ae4..7ae528cd6b205f09a4d4fb0f3e9e62c1574d533e 100644 (file)
@@ -73,9 +73,9 @@ fbs_spout(struct fastbuf *f)
   };
 
   int l = f->bptr - f->bstop;
-  f->bptr = f->bstop;
-  f->pos += l;
   char *buf = f->bstop;
+  f->pos += l;
+  f->bptr = f->bstop = f->buffer;
 
   while (l)
     {