From: Tobias Brunner Date: Thu, 24 Jan 2013 17:59:03 +0000 (+0100) Subject: Cast first argument for %.*s to int X-Git-Tag: 5.0.2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=677812dc66c4df0cb05c326623e6aec7dad51d99;p=thirdparty%2Fstrongswan.git Cast first argument for %.*s to int --- diff --git a/src/libimcv/plugins/imv_os/imv_os_database.c b/src/libimcv/plugins/imv_os/imv_os_database.c index eb4c2acbc3..c6db9953fb 100644 --- a/src/libimcv/plugins/imv_os/imv_os_database.c +++ b/src/libimcv/plugins/imv_os/imv_os_database.c @@ -68,8 +68,8 @@ METHOD(imv_os_database_t, check_packages, status_t, pos = memchr(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); - sprintf(product, "%.*s %.*s", os_name.len, os_name.ptr, - os_version_len, os_version.ptr); + sprintf(product, "%.*s %.*s", (int)os_name.len, os_name.ptr, + (int)os_version_len, os_version.ptr); } DBG1(DBG_IMV, "processing installed '%s' packages", product); @@ -148,7 +148,7 @@ METHOD(imv_os_database_t, check_packages, status_t, } } e->destroy(e); - + if (found) { if (match) diff --git a/src/libimcv/plugins/imv_os/imv_os_state.c b/src/libimcv/plugins/imv_os/imv_os_state.c index f16983611d..ca6e050f74 100644 --- a/src/libimcv/plugins/imv_os/imv_os_state.c +++ b/src/libimcv/plugins/imv_os/imv_os_state.c @@ -448,8 +448,8 @@ METHOD(imv_os_state_t, set_info, void, /* OS info is a concatenation of OS name and OS version */ free(this->info); this->info = malloc(len); - snprintf(this->info, len, "%.*s %.*s", name.len, name.ptr, - version.len, version.ptr); + snprintf(this->info, len, "%.*s %.*s", (int)name.len, name.ptr, + (int)version.len, version.ptr); this->type = type; this->name = chunk_clone(name); this->version = chunk_clone(version); diff --git a/src/libimcv/plugins/imv_os/pacman.c b/src/libimcv/plugins/imv_os/pacman.c index feb3ff399d..f5f52885dc 100644 --- a/src/libimcv/plugins/imv_os/pacman.c +++ b/src/libimcv/plugins/imv_os/pacman.c @@ -97,13 +97,13 @@ static time_t extract_time(char *line) char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; int i; - + 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) { return UNDEFINED_TIME; } - t.tm_isdst = 0; + t.tm_isdst = 0; t.tm_year -= 1900; t.tm_mon = 12; @@ -173,7 +173,7 @@ static void process_packages(char *filename, char *product, bool update) e->destroy(e); } if (!pid) - { + { if (db->execute(db, &pid, "INSERT INTO products (name) VALUES (?)", DB_TEXT, product) != 1) { @@ -221,8 +221,8 @@ static void process_packages(char *filename, char *product, bool update) pos = strchr(line, ' '); if (!pos) { - fprintf(stderr, "could not extract package name from '%.*s'", - strlen(line)-1, line); + fprintf(stderr, "could not extract package name from '%.*s'\n", + (int)(strlen(line)-1), line); errored++; continue; } @@ -240,8 +240,8 @@ static void process_packages(char *filename, char *product, bool update) } else { - fprintf(stderr, "could not extract package version from '%.*s'\n", - strlen(line)-1, line); + fprintf(stderr, "could not extract package version from " + "'%.*s'\n", (int)(strlen(line)-1), line); errored++; continue; } @@ -275,7 +275,7 @@ static void process_packages(char *filename, char *product, bool update) e->destroy(e); } if (!gid && security) - { + { if (db->execute(db, &gid, "INSERT INTO packages (name) VALUES (?)", 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 */ - e = db->query(db, + e = db->query(db, "SELECT id, release, security, time FROM versions " "WHERE package = ? AND product = ?", 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)) - { + { printf("%s (%s) %s\n", package, version, security ? "[s]" : ""); if (db->execute(db, &vid, diff --git a/src/libpts/plugins/imv_attestation/attest_db.c b/src/libpts/plugins/imv_attestation/attest_db.c index 1a902e5c2f..91e9766d01 100644 --- a/src/libpts/plugins/imv_attestation/attest_db.c +++ b/src/libpts/plugins/imv_attestation/attest_db.c @@ -827,7 +827,7 @@ METHOD(attest_db_t, list_devices, void, { 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++; last_id = id; } diff --git a/src/libpts/pts/pts.c b/src/libpts/pts/pts.c index ec5ac1e563..84a9961c8a 100644 --- a/src/libpts/pts/pts.c +++ b/src/libpts/pts/pts.c @@ -344,8 +344,8 @@ METHOD(pts_t, set_platform_info, void, /* platform info is a concatenation of OS name and OS version */ free(this->platform_info); this->platform_info = malloc(len); - snprintf(this->platform_info, len, "%.*s %.*s", name.len, name.ptr, - version.len, version.ptr); + snprintf(this->platform_info, len, "%.*s %.*s", (int)name.len, name.ptr, + (int)version.len, version.ptr); } METHOD(pts_t, get_tpm_version_info, bool,