Cast first argument for %.*s to int
This commit is contained in:
@@ -68,8 +68,8 @@ METHOD(imv_os_database_t, check_packages, status_t,
|
|||||||
pos = memchr(os_version.ptr, ' ', os_version.len);
|
pos = memchr(os_version.ptr, ' ', os_version.len);
|
||||||
os_version_len = pos ? (pos - os_version.ptr) : os_version.len;
|
os_version_len = pos ? (pos - os_version.ptr) : os_version.len;
|
||||||
product = malloc(os_name.len + 1 + os_version_len + 1);
|
product = malloc(os_name.len + 1 + os_version_len + 1);
|
||||||
sprintf(product, "%.*s %.*s", os_name.len, os_name.ptr,
|
sprintf(product, "%.*s %.*s", (int)os_name.len, os_name.ptr,
|
||||||
os_version_len, os_version.ptr);
|
(int)os_version_len, os_version.ptr);
|
||||||
}
|
}
|
||||||
DBG1(DBG_IMV, "processing installed '%s' packages", product);
|
DBG1(DBG_IMV, "processing installed '%s' packages", product);
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ METHOD(imv_os_database_t, check_packages, status_t,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
if (match)
|
if (match)
|
||||||
|
|||||||
@@ -448,8 +448,8 @@ METHOD(imv_os_state_t, set_info, void,
|
|||||||
/* OS info is a concatenation of OS name and OS version */
|
/* OS info is a concatenation of OS name and OS version */
|
||||||
free(this->info);
|
free(this->info);
|
||||||
this->info = malloc(len);
|
this->info = malloc(len);
|
||||||
snprintf(this->info, len, "%.*s %.*s", name.len, name.ptr,
|
snprintf(this->info, len, "%.*s %.*s", (int)name.len, name.ptr,
|
||||||
version.len, version.ptr);
|
(int)version.len, version.ptr);
|
||||||
this->type = type;
|
this->type = type;
|
||||||
this->name = chunk_clone(name);
|
this->name = chunk_clone(name);
|
||||||
this->version = chunk_clone(version);
|
this->version = chunk_clone(version);
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ static time_t extract_time(char *line)
|
|||||||
char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sscanf(line, "Generated: %3s %3s %2d %2d:%2d:%2d %4d UTC", wday, mon,
|
if (sscanf(line, "Generated: %3s %3s %2d %2d:%2d:%2d %4d UTC", wday, mon,
|
||||||
&t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec, &t.tm_year) != 7)
|
&t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec, &t.tm_year) != 7)
|
||||||
{
|
{
|
||||||
return UNDEFINED_TIME;
|
return UNDEFINED_TIME;
|
||||||
}
|
}
|
||||||
t.tm_isdst = 0;
|
t.tm_isdst = 0;
|
||||||
t.tm_year -= 1900;
|
t.tm_year -= 1900;
|
||||||
t.tm_mon = 12;
|
t.tm_mon = 12;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
}
|
}
|
||||||
if (!pid)
|
if (!pid)
|
||||||
{
|
{
|
||||||
if (db->execute(db, &pid, "INSERT INTO products (name) VALUES (?)",
|
if (db->execute(db, &pid, "INSERT INTO products (name) VALUES (?)",
|
||||||
DB_TEXT, product) != 1)
|
DB_TEXT, product) != 1)
|
||||||
{
|
{
|
||||||
@@ -221,8 +221,8 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
pos = strchr(line, ' ');
|
pos = strchr(line, ' ');
|
||||||
if (!pos)
|
if (!pos)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not extract package name from '%.*s'",
|
fprintf(stderr, "could not extract package name from '%.*s'\n",
|
||||||
strlen(line)-1, line);
|
(int)(strlen(line)-1), line);
|
||||||
errored++;
|
errored++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -240,8 +240,8 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not extract package version from '%.*s'\n",
|
fprintf(stderr, "could not extract package version from "
|
||||||
strlen(line)-1, line);
|
"'%.*s'\n", (int)(strlen(line)-1), line);
|
||||||
errored++;
|
errored++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
}
|
}
|
||||||
if (!gid && security)
|
if (!gid && security)
|
||||||
{
|
{
|
||||||
if (db->execute(db, &gid, "INSERT INTO packages (name) VALUES (?)",
|
if (db->execute(db, &gid, "INSERT INTO packages (name) VALUES (?)",
|
||||||
DB_TEXT, package) != 1)
|
DB_TEXT, package) != 1)
|
||||||
{
|
{
|
||||||
@@ -289,7 +289,7 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for package versions already in database */
|
/* check for package versions already in database */
|
||||||
e = db->query(db,
|
e = db->query(db,
|
||||||
"SELECT id, release, security, time FROM versions "
|
"SELECT id, release, security, time FROM versions "
|
||||||
"WHERE package = ? AND product = ?",
|
"WHERE package = ? AND product = ?",
|
||||||
DB_INT, gid, DB_INT, pid, DB_INT, DB_TEXT, DB_INT, DB_INT);
|
DB_INT, gid, DB_INT, pid, DB_INT, DB_TEXT, DB_INT, DB_INT);
|
||||||
@@ -350,7 +350,7 @@ static void process_packages(char *filename, char *product, bool update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!vid && security) || (vid && !vid_update))
|
if ((!vid && security) || (vid && !vid_update))
|
||||||
{
|
{
|
||||||
printf("%s (%s) %s\n", package, version, security ? "[s]" : "");
|
printf("%s (%s) %s\n", package, version, security ? "[s]" : "");
|
||||||
|
|
||||||
if (db->execute(db, &vid,
|
if (db->execute(db, &vid,
|
||||||
|
|||||||
@@ -827,7 +827,7 @@ METHOD(attest_db_t, list_devices, void,
|
|||||||
{
|
{
|
||||||
if (id != last_id)
|
if (id != last_id)
|
||||||
{
|
{
|
||||||
printf("%4d: %.*s\n", id, value.len, value.ptr);
|
printf("%4d: %.*s\n", id, (int)value.len, value.ptr);
|
||||||
device_count++;
|
device_count++;
|
||||||
last_id = id;
|
last_id = id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,8 +344,8 @@ METHOD(pts_t, set_platform_info, void,
|
|||||||
/* platform info is a concatenation of OS name and OS version */
|
/* platform info is a concatenation of OS name and OS version */
|
||||||
free(this->platform_info);
|
free(this->platform_info);
|
||||||
this->platform_info = malloc(len);
|
this->platform_info = malloc(len);
|
||||||
snprintf(this->platform_info, len, "%.*s %.*s", name.len, name.ptr,
|
snprintf(this->platform_info, len, "%.*s %.*s", (int)name.len, name.ptr,
|
||||||
version.len, version.ptr);
|
(int)version.len, version.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(pts_t, get_tpm_version_info, bool,
|
METHOD(pts_t, get_tpm_version_info, bool,
|
||||||
|
|||||||
Reference in New Issue
Block a user