All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte
@ 2019-10-29 23:12 Tim Kourt
  2019-10-29 23:12 ` [PATCH v2 2/2] client: Update rl_point to last known position Tim Kourt
  2019-10-29 23:17 ` [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Tim Kourt @ 2019-10-29 23:12 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

---
 client/display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/display.c b/client/display.c
index cd17ad84..105d05cb 100644
--- a/client/display.c
+++ b/client/display.c
@@ -397,7 +397,7 @@ static void display_completion_matches(char **matches, int num_matches,
 
 static struct masked_input {
 	bool use_mask;
-	char passphrase[MAX_PASSPHRASE_LEN];
+	char passphrase[MAX_PASSPHRASE_LEN + 1];
 	uint8_t point;
 	uint8_t end;
 } masked_input;
@@ -453,7 +453,7 @@ done:
 
 static void reset_masked_input(void)
 {
-	memset(masked_input.passphrase, 0, MAX_PASSPHRASE_LEN);
+	memset(masked_input.passphrase, 0, MAX_PASSPHRASE_LEN + 1);
 	masked_input.point = 0;
 	masked_input.end = 0;
 }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] client: Update rl_point to last known position
  2019-10-29 23:12 [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Tim Kourt
@ 2019-10-29 23:12 ` Tim Kourt
  2019-10-29 23:17 ` [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Kourt @ 2019-10-29 23:12 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Keep cursor's position consistent when passphrase is reaching
its maximum by adding characters in the middle of the string

The use case is very rare as not many people will attempt to
modify the masked passphrase from the middle.
---
 client/display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/client/display.c b/client/display.c
index 105d05cb..10c87b2a 100644
--- a/client/display.c
+++ b/client/display.c
@@ -408,7 +408,9 @@ static void mask_input(void)
 		return;
 
 	if (rl_end > MAX_PASSPHRASE_LEN) {
-		rl_point = rl_end = MAX_PASSPHRASE_LEN;
+		rl_end = MAX_PASSPHRASE_LEN;
+		rl_point = masked_input.point;
+
 		goto set_mask;
 	}
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte
  2019-10-29 23:12 [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Tim Kourt
  2019-10-29 23:12 ` [PATCH v2 2/2] client: Update rl_point to last known position Tim Kourt
@ 2019-10-29 23:17 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-10-29 23:17 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

Hi Tim,

On 10/29/19 6:12 PM, Tim Kourt wrote:
> ---
>   client/display.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

Both applied, thanks

Regards,
-Denis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-29 23:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 23:12 [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Tim Kourt
2019-10-29 23:12 ` [PATCH v2 2/2] client: Update rl_point to last known position Tim Kourt
2019-10-29 23:17 ` [PATCH v2 1/2] client: Increase passphrase buffer to accommodate for nil byte Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.