mirror of
https://github.com/Cacti/spine.git
synced 2026-10-26 04:57:03 +09:00
Classify numeric, undefined, multipart and Cacti octet results through one parser, normalize undefined agent values before persistence and flush every SNMP batch consistently. Validate whole non-negative uptimes, retain unknown reindex baselines and free script results through their owning pointer. The mocked poll_host suite checks session-profile boundaries, spike handling, output_regex input and completion writes. Originally step 4/14 of the C17/native-correctness series; its preceding steps have merged. The current base is develop. Earlier validation, before this review follow-up, in isolated copied snapshots on Linux arm64: - Clean GCC build and make check: 15 passed, 1 existing prerequisite skips, 0 failures. - ASan/UBSan: 14 passed, 2 existing privilege/allocator-interposition prerequisite skips, 0 failures; no sanitizer findings. - Production source/profile integrity verification against disposable MariaDB and loopback SNMP fixtures passed. - Release archive extracted into a separate source tree and built/tested out of tree; fuzz checks passed. Earlier local profiles retain source hashes for the copied validation tree; GitHub checks validate the published commit. No production database/device, host installation or live privilege change is part of validation. Existing prerequisite skips were retained; no test or finding was suppressed to obtain a pass. Review follow-up (2026-10-09): Restacked on the corrected preceding branches. The SNMP status fix is introduced in #638, the reindex/completion fixes in #640, and focused regression coverage in #650. Restacked tip validation: isolated Linux arm64 build and make check passed (18 passed, 1 setuid prerequisite skip, no failures). GitHub checks validate the updated published commits; earlier profile/archive/sanitizer evidence above belongs to the previous revisions. ## Current merge dependencies Current base: `develop`. Immediate dependency: `develop` (earlier steps already merged). Next open PR: [#644](https://github.com/Cacti/spine/pull/644). Merge order: #641 → #644 → #654 → #646 → #648 → #649 → #650 → #651 → #655 → #658 → #659. This repository uses squash-only merges and deletes merged branches. Record the old parent SHA, squash one PR at a time, then restack and retarget dependents before merging the next PR. Re-run merge validation and checks on the resulting heads; an ordinary clean merge does not replace squash/restack validation. --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
| |
|
|
| This program is free software; you can redistribute it and/or |
|
|
| modify it under the terms of the GNU Lesser General Public License |
|
|
| as published by the Free Software Foundation; either version 2.1 |
|
|
| of the License, or (at your option) any later version. |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "common.h"
|
|
#include "spine.h"
|
|
#include "poller.h"
|
|
#include "util.h"
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
char value[1025];
|
|
char row[RESULTS_BUFFER + SMALL_BUFSIZE];
|
|
const char *result;
|
|
static const char *expressions[] = {
|
|
REGEX_NUMBER,
|
|
"[0-9][0-9]*",
|
|
"[a-zA-Z][a-zA-Z0-9_.:-]*",
|
|
".*"
|
|
};
|
|
size_t value_len;
|
|
|
|
if (data == NULL || size == 0 || size > sizeof(value)) {
|
|
return 0;
|
|
}
|
|
|
|
value_len = size - 1;
|
|
memcpy(value, data + 1, value_len);
|
|
value[value_len] = '\0';
|
|
|
|
result = regex_replace(expressions[data[0] %
|
|
(sizeof(expressions) / sizeof(expressions[0]))], value);
|
|
if (result == NULL) {
|
|
abort();
|
|
}
|
|
|
|
(void)format_poller_output_row(row, sizeof(row), 1,
|
|
"fuzz", "1700000000", result);
|
|
classified_result_t classified;
|
|
if (classify_result(value, &classified) == RESULT_UNKNOWN &&
|
|
!IS_UNDEFINED(classified.text)) {
|
|
abort();
|
|
}
|
|
|
|
return 0;
|
|
}
|