Plan 9 from Bell Labs’s /usr/web/sources/contrib/mospak/hget-readline-overflow/hget-readline-overflow.diff

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


--- sys/src/cmd/hget.c
+++ sys/src/cmd/hget.c
@@ -1289,6 +1289,7 @@ readline(int fd, char *buf, int len)
 
 	for(p = buf;;){
 		if(b.rp >= b.wp){
+			b.rp = b.wp = b.buf;
 			n = read(fd, b.wp, sizeof(b.buf)/2);
 			if(n < 0)
 				return -1;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.