[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Obtaining NMH_BUFSIZ in a Test.
From: |
Ralph Corderoy |
Subject: |
Obtaining NMH_BUFSIZ in a Test. |
Date: |
Tue, 11 May 2021 15:53:24 +0100 |
Hi,
I've been fixing some buffer-overflow bugs which can cause SIGSEGV.
I think I've done the fixes and want to add tests to spot regressions.
Key to the test is the size of the buffer, typically NMH_BUFSIZ.
$ G g -B4 'define NMH_BUFSIZ'
h/mh.h-/*
h/mh.h- * This macro is for use by scan, for example, so that platforms with
h/mh.h- * a small BUFSIZ can easily allocate larger buffers.
h/mh.h- */
h/mh.h:#define NMH_BUFSIZ max(BUFSIZ, 8192)
$
I see some tests already hard code 8192. Alternatives include:
- Adding a trivial test/nmhbufsiz.c which prints it but none of the
existing test-support C files use NMH code AFAICS
- Having mhparam(1) print it, but it currently doesn't list internal
constants like that, even with ‘-debug’.
If no one objects or there's no better idea then I'll plump for the
first option.
--
Cheers, Ralph.
- Obtaining NMH_BUFSIZ in a Test.,
Ralph Corderoy <=