shithub: riscv

Download patch

ref: bcaf95bb5a60cd0fabbf5a20cd34a657e832484a
parent: a37402be19e88395a17196b829cafebf5bdcb387
author: cinap_lenrek <[email protected]>
date: Sun Feb 24 22:45:49 EST 2019

libpanel: fix %.*s format in pl_snarfentry()

--- a/sys/src/cmd/mothra/libpanel/entry.c
+++ b/sys/src/cmd/mothra/libpanel/entry.c
@@ -22,8 +22,8 @@
 	if(p->flags&USERFL)	/* no snarfing from password entry */
 		return nil;
 	ep=p->data;
-	n=ep->entp-ep->entry;
-	if(n<=0) return nil;
+	n=utfnlen(ep->entry, ep->entp-ep->entry);
+	if(n<1) return nil;
 	return smprint("%.*s", n, ep->entry);
 }
 void pl_pasteentry(Panel *p, char *s){