Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: John Ames Newsgroups: comp.os.linux.misc Subject: Re: VMS Date: Mon, 21 Jul 2025 14:05:59 -0700 Organization: A noiseless patient Spider Lines: 19 Message-ID: <20250721140559.000002e1@gmail.com> References: <20250625093213.00002ec2@gmail.com> <20250625094418.00007fd2@gmail.com> <105iv02$3cuhr$2@dont-email.me> <20250721091242.00007573@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Mon, 21 Jul 2025 21:06:04 +0000 (UTC) Injection-Info: dont-email.me; posting-host="753731d93e7185eb75ed51ccf5386484"; logging-data="3130255"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3o3es3ssrYjwJlKaajOTL/7sKtMzXotg=" Cancel-Lock: sha1:eZSke/MFk/IlGq9PGh1pCD1qLA4= X-Newsreader: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Xref: csiph.com comp.os.linux.misc:69822 On Mon, 21 Jul 2025 20:47:23 +0100 Richard Kettlewell wrote: > If you need 20 bytes and you=E2=80=99ve only got 10, _something_ is going= to > go wrong. A bounds check will avoid the outcome being a buffer > overrun, but you=E2=80=99re still going to have to report an error, or ex= it > the program, or some other undesired behaviour, when what you > actually wanted was the full 20-byte result. Additionally, if the system you're putting together is one where you might *ever* need to accept inputs of arbitrary size gracefully, you should *really* be asking yourself whether a fixed-length buffer is the right choice, or whether you should be looking at some more readily extensible structure. Even in languages where you don't get dynamic arrays or lists for "free," it is really not *that* hard to implement something more robust.