Skip to content

Commit d7b8284

Browse files
sidt4joebonrichie
authored andcommitted
Fix invalid size checks for size and download-size for spawned backends
Up to MAXUINT64 is supported
1 parent 6e70a6f commit d7b8284

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/pk-backend-spawn.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,16 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn,
195195
group = pk_group_enum_from_string (sections[4]);
196196

197197
/* ITS4: ignore, checked for overflow */
198-
package_size = atol (sections[7]);
199-
if (package_size > 1073741824) {
200-
g_set_error_literal (error, 1, 0,
201-
"package size cannot be that large");
198+
if (!pk_strtoulong (sections[7], &package_size)) {
199+
g_set_error (error, 1, 0,
200+
"failed to parse package size: '%s'",
201+
sections[7]);
202202
return FALSE;
203203
}
204-
download_size = atol (sections[8]);
205-
if (download_size > 1073741824) {
206-
g_set_error_literal (error, 1, 0,
207-
"download size cannot be that large");
204+
if (!pk_strtoulong (sections[8], &download_size)) {
205+
g_set_error (error, 1, 0,
206+
"failed to parse download size: '%s'",
207+
sections[7]);
208208
return FALSE;
209209
}
210210

0 commit comments

Comments
 (0)