可使用如下程序测试:
#include <sys/types.h>
#include <db.h>
#include <err.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main()
{
const char data[] = "abcd";
DB *db;
DBT dbt;
/*
* Set _malloc_options to "J" so that all memory obtained from
* malloc(3) is iniatialized to 0x5a. See malloc(3) manual page
* for additional information.
*/
_malloc_options = "J";
db = dbopen("test.db", O_RDWR | O_CREAT | O_TRUNC, 0644, DB_HASH, NULL);
if (db == NULL)
err(1, "dbopen()");
dbt.data = &data;
dbt.size = sizeof(data);
if (db->put(db, &dbt, &dbt, 0) != 0)
err(1, "db->put()");
db->close(db);
return (0);
}
运行程序,可以看到test.db中包含来自malloc(3)中的0xa5字节。PR 123529
(http://www.freebsd.org/cgi/query-pr.cgi?pr=123529)报告中证实了一个实际例子,导致敏感密码信息泄漏。
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation