fix(ui): validate and clamp dialog input

Tighten input handling across several dialogs so bad/edge input can't
produce a doomed request or a confusing display:

- app_security: passphrase strength meter now factors character-class
  diversity — an all-one-class string downgrades one tier so "aaaaaaaa"
  no longer scores as high as a mixed one.
- block_info: clamp the height field to the chain tip and hide/deny
  "Next" at the tip (was only yielding a raw RPC error).
- address_label: trim surrounding whitespace before saving; a
  whitespace-only label clears it (mirrors clearing the icon).
- send_tab: re-clamp the amount when a Max send has its fee bumped in the
  confirm popup (kept the total within budget) and NUL-terminate the
  strncpy'd address/memo when a payment URI overwrites the form.
- settings_page: reject an empty/whitespace-only lite wallet path before
  dispatching an unusable open/restore request.
- peers_tab: guard ExtractIP against an empty address.
- transaction_details: disable "View in explorer" when the configured
  explorer URL is empty/whitespace so we never open a garbage link.
- app: seed-backup "Skip" now requires a second, deliberate click with a
  fund-loss warning before it dismisses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 15:08:59 -05:00
co-authored by Claude Opus 4.8
parent 41f5548593
commit 658c0f355b
8 changed files with 118 additions and 14 deletions
+11 -2
View File
@@ -115,6 +115,11 @@ void BlockInfoDialog::render(App* app)
ImGui::SetNextItemWidth(heightInput.width);
ImGui::InputInt("##Height", &s_height);
if (s_height < 1) s_height = 1;
// Clamp to the chain tip so navigation/typing can't request a height
// above the tip (which would only yield a raw RPC error).
if (state.sync.blocks > 0 && s_height > state.sync.blocks) {
s_height = state.sync.blocks;
}
ImGui::SameLine();
@@ -287,7 +292,8 @@ void BlockInfoDialog::render(App* app)
if (ImGui::IsItemHovered()) {
material::Tooltip("%s", TR("block_click_next"));
}
if (ImGui::IsItemClicked()) {
if (ImGui::IsItemClicked() &&
(state.sync.blocks <= 0 || s_height < state.sync.blocks)) {
s_height++;
s_has_data = false;
}
@@ -308,7 +314,10 @@ void BlockInfoDialog::render(App* app)
ImGui::SameLine();
}
if (!s_next_hash.empty()) {
// Only offer "Next" when below the chain tip (the tip block has no
// nextblockhash, so this stays hidden there).
if (!s_next_hash.empty() &&
(state.sync.blocks <= 0 || s_height < state.sync.blocks)) {
if (material::StyledButton(TR("block_nav_next"), ImVec2(0,0), S.resolveFont(closeBtn.font))) {
s_height++;
s_has_data = false;