Mageia Bugzilla – Attachment 8523 Details for
Bug 19571
overflow when querying for size with urpmq
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
patch to avoid overflow when querying rpm size using unsigned int
URPM-overflow-use-unsigned.patch (text/plain), 916 bytes, created by
Giuseppe Ghibò
on 2016-10-12 14:44:49 CEST
(
hide
)
Description:
patch to avoid overflow when querying rpm size using unsigned int
Filename:
MIME Type:
Creator:
Giuseppe Ghibò
Created:
2016-10-12 14:44:49 CEST
Size:
916 bytes
patch
obsolete
>diff -up URPM-5.07/URPM.xs.overflow URPM-5.07/URPM.xs >--- URPM-5.07/URPM.xs.overflow 2016-10-12 13:49:02.599699533 +0200 >+++ URPM-5.07/URPM.xs 2016-10-12 14:06:02.572054113 +0200 >@@ -201,7 +201,7 @@ get_arch(const Header header) { > return headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src"; > } > >-static int >+static unsigned int > get_int(const Header header, rpmTag tag) { > struct rpmtd_s val; > >@@ -756,7 +756,7 @@ pack_header(const URPM__Package pkg) { > const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); > const char *arch = get_arch(pkg->h); > >- p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%d@%s", nvr, arch, >+ p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%lu@%s", nvr, arch, > get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), > get_name(pkg->h, RPMTAG_GROUP)); > pkg->info = memcpy(malloc(p-buff), buff, p-buff);
diff -up URPM-5.07/URPM.xs.overflow URPM-5.07/URPM.xs --- URPM-5.07/URPM.xs.overflow 2016-10-12 13:49:02.599699533 +0200 +++ URPM-5.07/URPM.xs 2016-10-12 14:06:02.572054113 +0200 @@ -201,7 +201,7 @@ get_arch(const Header header) { return headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src"; } -static int +static unsigned int get_int(const Header header, rpmTag tag) { struct rpmtd_s val; @@ -756,7 +756,7 @@ pack_header(const URPM__Package pkg) { const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); const char *arch = get_arch(pkg->h); - p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%d@%s", nvr, arch, + p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%lu@%s", nvr, arch, get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), get_name(pkg->h, RPMTAG_GROUP)); pkg->info = memcpy(malloc(p-buff), buff, p-buff);
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19571
:
8522
|
8523
|
8525
|
8528
|
8529
|
8530
|
8531
|
8537
|
8538
|
8539
|
8541
|
8542
|
8543
|
8547
|
8548
|
8549
|
8563
|
8564
|
8565
|
8566