CK Core CDE
CK Core CDE

Hardening baseline and audit ledger

CK Core CDE is legacy C and C++ that is being brought to C23 and audited for null-pointer, memory, overflow and unhandled-edge-case defects. This page records the measured starting point and which components have been audited, so each change can be checked against it. The opt-in build switches are described in Build.

Method

Build with --enable-hardening at -O2 and keep the complete make log. The counting tool scripts/warning-baseline.py attributes each compiler warning to a component, counts it once however many translation units include its header, and compares a later log with a recorded baseline:

scripts/warning-baseline.py record make.log --depth 2 --strip "$PWD" --label cde-hard > baseline.json
scripts/warning-baseline.py compare make.log baseline.json --depth 2 --strip "$PWD"

compare fails when any component and class has more warnings than the baseline, so the baseline is a ratchet: counts may only fall. The list mode prints the individual warnings of chosen classes for triage. Once a defect warning class reaches zero across the entire tree, --enable-hardening promotes it to -Werror=<class> in cde/m4/ck_hardening.m4. For Phase 2 warning classes (-Wsign-compare and -Wmissing-field-initializers), CK_HARDENING_INIT also populates $(CK_HARDENING_PHASE2_FLAGS) (-Werror=sign-compare and -Werror=missing-field-initializers under --enable-hardening), ratcheting each cleaned library and program (lib/DtXinerama, lib/DtPrint, lib/DtTerm, lib/tt, programs/dtaction, programs/dtcalc, programs/dtcreate, programs/dtdbcache, programs/dtexec, programs/dthello, programs/dticon, programs/dtimsstart, programs/dtlogin, programs/dtpad, programs/dtpdm, programs/dtpdmd, programs/dtportal, programs/dtprintinfo, programs/dtsearchpath, programs/dtspcd, programs/dtstyle, programs/dtterm, and programs/util/dttypes) component-by-component on both GCC and Clang so cleaned subtrees cannot regress while larger C++ modules are worked down.

Baseline 2026-11-04 and 2026-11-16 defect-class burndown

GCC 14.2 on Debian 13 arm64, -O2 -g0, --enable-hardening, six jobs, against CK Core Motif 20a1461b1 (2026-11-04 baseline) and CK Core Motif 0509cc8cd (2026-11-16 defect-class burndown) built with the same profile. The machine-readable starting record is validation/2026-11-04-hardening-baseline.json.

The 2026-11-04 baseline reported 10,354 unique warnings, with 1,126 in sixteen defect classes pointing at memory-safety, lifetime, error-handling, pointer-cast or control-flow defects. After the 2026-11-16 burndown, all sixteen tracked defect classes reached zero across the entire tree and are enforced with -Werror=... under --enable-hardening; total unique warnings dropped to 8,724 and remaining defect-class warnings dropped to 0.

Warning class2026-11-04 baseline2026-11-16 count--enable-hardening gate
-Wunused-result3890-Werror=unused-result
-Wcast-function-type2210-Werror=cast-function-type
-Wnull-dereference1160-Werror=null-dereference
-Wimplicit-fallthrough1080-Werror=implicit-fallthrough
-Wmisleading-indentation1060-Werror=misleading-indentation
-Wformat-truncation520-Werror=format-truncation
-Wreturn-type360-Werror=return-type
-Wmaybe-uninitialized210-Werror=maybe-uninitialized
-Waddress210-Werror=address
-Wstringop-truncation170-Werror=stringop-truncation
-Wuse-after-free130-Werror=use-after-free
-Wstringop-overflow90-Werror=stringop-overflow
-Wformat-overflow80-Werror=format-overflow
-Warray-bounds60-Werror=array-bounds
-Wrestrict20-Werror=restrict
-Wfree-nonheap-object10-Werror=free-nonheap-object

The 2026-11-04 cppcheck baseline reported 1,380 messages in product code (239 errors, 969 warnings, 167 portability: memleakOnRealloc 73, uninitvar 69, memleak 19, missingReturn 16, legacyUninitvar 15, nullPointerArithmeticOutOfMemory 11, shiftTooManyBitsSigned 10, nullPointer 9). After the 2026-11-16 audit (-Dnullptr=NULL for C23 nullptr), product-code messages dropped to 630 (32 errors, 420 warnings, 173 portability), with memleakOnRealloc 0, missingReturn 0, legacyUninitvar 0, shiftTooManyBitsSigned 0, nullPointer 0, memleak 6, uninitvar 7 (all in vendored lib/pam/pam_modules/dce), and nullPointerArithmeticOutOfMemory 1 (in vendored lib/DtHelp/il). Test and demo directories are excluded, as are cppcheck's own analysis-depth notices and parse failures.

Audit ledger

A component is audited when a topic commit records a review of its complete input path, not when a compiler is quiet. Components marked "none recorded" have not had such a review. Thirteen libFuzzer targets under cde/fuzz/ cover the highest-exposure network, session, window-property, database, mail, calendar and help parsers and are replayed in CI via python3 cde/fuzz/run-fuzz.py --all --replay.

ComponentExposurePrior hardeningUnique warnings (baseline -> current)Defect-class (baseline -> current)cppcheck errors (baseline -> current)Fuzz targets
programs/dtappbuilderdeveloper tool; mostly generated stubstemporary files, checked allocations, browser null checks and codegen bounds (2026-11-12, 2026-11-14); abmf mf_calloc overflow guard, fopen null check, ui_c_file.c indentation, msg_file.c/test.c realloc preservation and write_c.c va_end pairing (2026-11-16)1,594 -> 1,51459 -> 028 -> 0none
programs/dtmailunprivileged mailer; set-group-id spool helper (dtmailspool); mail and MIME parsingmail spool helper split from the mailer (2026-11-10), mailbox save and path handling, text made from a message, command-line and session input, ToolTalk request data, mail server clients, message/partial assembly, MIME and lock file text (2026-11-10); signal handling, checked allocations, C++ allocator pairing, RFCMailBox error-logging braces and MenuBar/RoamCmds/DtMailGenDialog/Help fixes (2026-11-13, 2026-11-16); RFCMIME Base64/Quoted-Printable/From bounds, RFCMailValues::decodeRFC1522 bounds and ItipBanner memmem bounds (2026-11-27)1,369 -> 1,31644 -> 00 -> 0dtmail-rfc5322
programs/dtcmincludes rpc.cmsd (RPC server run as root); calendarrpc.cmsd request path (2026-11-04); signal handling, access checks, recurrence rules (2026-11-10); mkstemp drop/load files, checked allocations, XtNewString/XtFree pairing and bounded string formatting (2026-11-12, 2026-11-16); ics_io DURATION:/INTERVAL=/COUNT= signed-overflow guards (2026-11-27)879 -> 79559 -> 05 -> 1dtcm-icalendar
programs/dtfilefile operations; drag and dropTrash, copy and transfer (2026-11-02, 2026-11-03); faccessat(AT_EACCESS), owner-before-mode attribute updates, signal dispositions and checked allocations (2026-11-13, 2026-11-14); in-process $VAR/${VAR} expansion in _DtPathFromInput, _DtFollowLink/_DtPName/_DtBuildPath bounds, (st_dev, st_ino) hardlink block deduplication in StorageSize, and FileMgr slash-less path handling (2026-11-16)813 -> 561203 -> 010 -> 0none
programs/dthelphelp compiler; SGML parserliteral buffer bounds, checked allocations and realloc failure handling (2026-11-13, 2026-11-14); canon1/pass1 xref.c, malloc.c, help.c and param.c fixes, dthelpgen topic-path bounds, and dthelpprint O_CREAT | O_EXCL (0600) temp-file creation and bounded formatting (2026-11-16)644 -> 52464 -> 04 -> 2none
lib/DtSvcSPC protocol shared by dtspcd and its clients; data-type databaseSPC wire layer and data-type lookup (Dts.c) (2026-11-04); data-type matching, database file reader, termios strings (2026-11-10); _DtSignal, self-pipe SIGCHLD, DtDbReader and DtsMM cache bounds, checked allocations and bounded strings (2026-11-13, 2026-11-14)412 -> 38724 -> 022 -> 5spc-proto, dtsvc-dbreader, dtsvc-mmcache
programs/dtwmwindow manager; property and request readersproperty and request readers (2026-11-02); XtAppAddSignal termination, session/resource parser bounds and checked allocations (2026-11-13, 2026-11-14); WmParse/WmResParse environment and session field bounds, DataBaseLoad duplicate elimination index and Realloc preservation, WmWrkspace/WmResource/WmIPC/WmBackdrop/WmEvent/WmImage/WmXSMP fixes (2026-11-16)410 -> 36722 -> 042 -> 0dtwm-property, dtwm-session
lib/ttttsession and rpc.ttdbserverd (sockets, RPC)ttsession request decoding, authentication levels, start environment; rpc.ttdbserverd request path (2026-11-04); environment of privileged processes, object property updates, notices (2026-11-10); signal dispositions, mini_isam checked allocations, typed RPC dispatch thunks in db_server_svc.C, mp_c_session X11 ping fallback, and tt_tracefile_parse switch break (2026-11-13, 2026-11-16)394 -> 150242 -> 01 -> 0none
programs/dtsrlocal user programdamaged index (2026-11-10); async-signal-safe shutdown (2026-11-13); huffcode, dtsrclean, dtsrkdump, dtsrhan, tomita, dtsrindex and dtsrload bounds and null checks (2026-11-16)370 -> 3653 -> 00 -> 0none
programs/ttsnooplocal user programDtTt stream output bounds, O_CREAT mode and temp-file cleanup, strdup environment lifetime, choiceOkayed/argOkayed switch breaks, msgReject dispatch and getopt -m option argument (2026-11-16)359 -> 3509 -> 00 -> 0none
programs/dtprintinfolocal user programutil/Privilege.h privilege drop checks, checked allocations and C++ allocator pairing (2026-11-13, 2026-11-14); ParseJobs temp-file mkstemp, bounded parser tokens, child process reaping in Invoke, bounded Queue/PrintJob/Process/MotifThread command formatting, Button.C arrow direction switch breaks, and snprintf across UI/ and libUI/ (2026-11-16)345 -> 30720 -> 00 -> 0none
lib/DtSearchfull-text search; vendored raima subtree excludeddamaged index (2026-11-10); async-signal-safe signal_abort and checked allocations (2026-11-13, 2026-11-14); split_llist/merge_llist/sort_llist and ditto_sort, clean_wrap empty-string bounds, 64-bit DtSrObjdate validation, fread_d99_header hole_count clamping, is_matching_rule/paice_stemmer suffix bounds, raima/fillnew.c field_table bounds and ocf/boolpars/hilite bounds (2026-11-16)285 -> 25212 -> 05 -> 0none
lib/DtTermterminal emulation; escape-sequence parserparser bounds (2026-11-02); setuid handling (2026-11-04); _DtSignal, checked allocations, bounded string formatting, TermFunction eraseFromCol0 break and TermViewMenu cascade-button braces (2026-11-14, 2026-11-16); TermPrim wcstombs error check + leak fix and Phase 2 -Werror=sign-compare -Werror=missing-field-initializers ratchet (2026-11-27)258 -> 23620 -> 014 -> 0none
lib/DtHelphelp file and markup parsingstring handling (2026-11-02); SDL parser bounds, stream EOF checks and realloc failure handling (2026-11-13, 2026-11-14); FormatUtil mblen error guard, FormatCCDF titleChunks free, FormatTerm null guard, SDLI.h and il/ unsigned shift masks and realloc preservation across FormatSDL, Graphics, HelpUtil, Access, FileUtils and GlobSearch (2026-11-16); UtilSDL/FormatSDL unsigned-char BUFFILEEOF fixes, CCDFUtil EOF/backslash/quoted-newline/leak fixes, and FormatUtil _DtHelpCeAddOctalToBuf/_DtHelpCeAddStrToBuf bounds (2026-11-27)248 -> 17573 -> 034 -> 2dthelp-sdl, dthelp-sgml
programs/dtstylelocal user programpalette lookup null checks, _DtSignal and checked allocations (2026-11-13, 2026-11-14); ColorFile list-unlink and ReadInInfo bounds, I18nEnv pipe accumulation and GetImsList bounds, and bounded snprintf across ColorMain, ColorEdit, Backdrop, SaveRestore, I18nMain, Dtwm, Startup, Audio, Keyboard, Font, Screen and Mouse (2026-11-16)218 -> 20312 -> 03 -> 0none
lib/csaRPC interface of rpc.cmsdrequest decoding used by rpc.cmsd (2026-11-04); limits and lists of the protocols (2026-11-10); hash/name table checked allocations, ISO 8601 bounds and bounded strings (2026-11-13, 2026-11-14)189 -> 1788 -> 00 -> 0none
programs/dtloginruns as root; XDMCP network serviceenvironment and arguments (2026-11-02); XDMCP, authorization, signals (2026-11-04); chooser, displays, configuration files, expired passwords, session signals, greeter requests (2026-11-10); XDMCP forward port and Xaccess alias cycle bounds, BoundedCall, netaddr.c addressEqual null guard, checked allocations and bounded strings (2026-11-13, 2026-11-16)163 -> 14121 -> 09 -> 0dtlogin-xdmcp, dtlogin-xaccess
programs/dtkshlocal user programXDraw wrapper return values (2026-11-13); xmcvt and dtkcvt 64-bit resource/callback converters, DtkshCvtStringToTtScope, DtkshNameToWidget and getname bounds, and xmcmds/dtkcmds argument and EOF checks (2026-11-16)157 -> 14115 -> 00 -> 0none
programs/dtinfoinformation browser; C++DtMmdb/dtinfo new[]/delete[] and malloc/free pairing and checked allocations (2026-11-14); DtMmdb memory_pool large-allocation header and ll4 alignment, buffer::expand_chunk alignment and pointer-offset arithmetic, DtSR_SearchResultsEntry::overlay_proximity bitmask precedence and negative-zone guard, WWL/FolioObject typed callback thunks, cgmcmds.c scale table and leak fixes, StyleSheetMgr/OutlineListView null guards and realloc preservation (2026-11-16)154 -> 12430 -> 07 -> 0none
programs/dtsessionsession manager; screen lock checked through PAM; reads saved sessions; ICE and X clientsinstalled identity, screen lock, signals, session files and saves, client start, ICE authority, saved sessions and palettes, XSMP callbacks and client lifetimes, startup resources (2026-11-04); mkdtemp, palette/client parser bounds, checked allocations and bounded strings (2026-11-12, 2026-11-14)135 -> 12212 -> 02 -> 0dtsession-client, dtsession-palette
programs/dtsearchpathdtappgather is always setuid rootDTUSERSESSION traversal, symlink and lchown checks, privilege-drop ordering before session cleanup, CTokenizedString bounds and TTFile allocator pairing (2026-11-15)46 -> 320 -> 00 -> 0none
programs/dtspcdroot daemon from inetd; network; parses requests before authenticationrequest handlers, registration and privilege drop (2026-11-04); self-pipe signal loop, checked allocations and bounded strings (2026-11-13, 2026-11-14)6 -> 33 -> 01 -> 0none
programs/dtexeclaunches user commandsdiscovery (2026-11-02); self-pipe signal loop (2026-11-13); CommandListJoin negative-count guard and checked realloc in ParseCommandLine and error-pipe drain (2026-11-16)5 -> 41 -> 02 -> 0none

Components below 150 unique warnings are recorded in the JSON baseline; the following smaller libraries and desktop utilities have also been audited and covered by sanitizer regressions (2026-11-16):

  • lib/DtMmdb: memory_pool large-allocation header and ll4 alignment, buffer::expand_chunk power-of-two capacity and pointer-offset restoration, compression/trie checked allocations, char_stack/void_ptr_stack underflow guards, and atomic_lock bounds (cde/lib/DtMmdb/tests/check-dtmmdb-hardening.py).
  • lib/DtWidget & lib/DtPrint: ComboBox, SpinBox and Editor/SearchCalls bounds and null checks, and PsubUtil printer list parsing (cde/programs/dtcreate/tests/check-desktop-apps-hardening.py).
  • programs/dtcreate, programs/dtpad, programs/dticon, programs/dtcalc, programs/dtimsstart: parser.c buffer bounds and cmncbs.c mkstemp creation (dtcreate), fileIo.c mkstemp panic-save and bounded ttMsgSupport.c formatting (dtpad), ProcessToolTalkMediaMessage path copy bounds and utils.c DontCare fallback (dticon), calctool.c get_label clamping and ds_popup.c bounds (dtcalc), and remote.c/env.c/start.c/file.c/action.c/select.c bounds (dtimsstart) (cde/programs/dtcreate/tests/check-desktop-apps-hardening.py).
  • programs/dtdocbook, programs/dtudcfonted, programs/dtudcexch, programs/dtpdm, programs/localized/util: infolib EmptyDir traversal guard and NCFGen field widths (dtdocbook), addcpf/ufont/importbdf bounds (dtudcfonted, dtudcexch), PdmOidStrs and Main.c argv bounds (dtpdm), and merge.c checked allocations (localized/util) (cde/programs/dtdocbook/infolib/tests/check-dtdocbook-udc-hardening.py).

Excluded from mechanical rewrites

Vendored and generated code is reviewed but not reformatted or mass-rewritten: lib/pam, util/tradcpp, lib/DtSearch/raima, lib/tt/mini_isam, the checked-in generator outputs (programs/dtinfo WWL tree, programs/dtappbuilder/src, programs/dthelp/parser, ToolTalk frozen.*). Where a generator exists, fix the generator.

Known limits

  • The sanitizers CI job builds CK Core Motif and CK Core CDE with --enable-sanitizers (AddressSanitizer and UndefinedBehaviorSanitizer) and runs make check; the fuzz-replay CI job replays all 13 libFuzzer corpora via python3 cde/fuzz/run-fuzz.py --all --replay.
  • The desktop smoke test has not yet been run under the sanitizers.
  • cppcheck ran with --max-configs=1, so code behind alternative #ifdef configurations is not analysed.