foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

commit 4c76bbf57903774dfdd3dfa5733dcbf5dae2797d
parent 886800f1960a1ae770a27769fa24524ac7c706cc
Author: Andrew Laack <andrew@laack.co>
Date:   Sun,  4 Oct 2026 11:50:41 -0500

Handle overflows for inputs

Diffstat:
MTODO.txt | 3+--
Minclude/shared.hpp | 2--
Msrc/utils.cpp | 2+-
3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/TODO.txt b/TODO.txt @@ -1,5 +1,3 @@ -- man pages -- if I enter some large fucking number like 120349871023948712304987 it searches because stoi probably fails, or our check does. - localhost access - localhost:1965 broken - cleanups @@ -10,3 +8,4 @@ - tests - remove useless ones - formatter +- man pages diff --git a/include/shared.hpp b/include/shared.hpp @@ -20,8 +20,6 @@ extern uint8_t COLOR_LIST_ITEM; // color used for list items extern uint8_t COLOR_FORMAT_SWITCH; // color used for format switch lines extern uint8_t COLOR_PLAINTEXT; // color used for plaintext lines - - // We guarantee responses can be at least the size limit, and at most 4096 additional bytes extern int RESPONSE_SIZE_LIMIT_MB; diff --git a/src/utils.cpp b/src/utils.cpp @@ -377,7 +377,7 @@ Destination handleDestinationResolution(std::string destination, bool isCli) { try { std::size_t pos = 0; int dest = std::stoi(destination,&pos); - if(pos == destination.size()) { + if(pos == destination.size() && dest >= 0) { // overflow or not full conversion ret.linkNumber = dest; ret.t = NUMBER_DESTINATION; return ret;