Package: libaws3.3.2
Version: 3.3.2-2
Severity: important
Tags: patch

Dear Maintainer,

Patch status:

Ref https://github.com/AdaCore/aws/pull/73, already merged to upstream master,
will be released with v20.0. I'll attach the patch from this git commit, please
patch current and later version.


Details:

In file src/core/aws-client.adb, line 1137, procedure Upload.

This procedure makes a multipart/form-data request in order to upload a file.
Line 1173 defines Content_Length function to calculate the form payload length
of this request.

This calculation function, however, is incorrect and should return 4 bytes
larger. The calculation of boundary length happens in line 1175, which simply
takes Boundary'Length. Boundary was defined in line 1149 and does not have "--"
prefix, while Line 1197 and 1229 sends boundary with a "--" prefix (defined as
Pref_Suf).



-- System Information:
Debian Release: 9.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 4.17.0-0.bpo.1-amd64 (SMP w/16 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libaws3.3.2 depends on:
ii  libc6                            2.24-11+deb9u3
ii  libgcc1                          1:6.3.0-18+deb9u1
ii  libgnat-6                        6.3.0-18+deb9u1
ii  libgnutls30                      3.5.8-5+deb9u4
ii  libldap-2.4-2                    2.4.44+dfsg-5+deb9u2
ii  libtemplates-parser11.10.1       11.10-4
ii  libxmlada-dom4.5.2015            4.5.2015-8+b2
ii  libxmlada-input-sources4.5.2015  4.5.2015-8+b2
ii  libxmlada-sax4.5.2015            4.5.2015-8+b2
ii  libxmlada-unicode4.5.2015        4.5.2015-8+b2
ii  zlib1g                           1:1.2.8.dfsg-5

libaws3.3.2 recommends no packages.

libaws3.3.2 suggests no packages.
>From 2d4739061b79dcdf7c45ef399f644454f0b538ae Mon Sep 17 00:00:00 2001
From: Afa Cheng <[email protected]>
Date: Sun, 9 Dec 2018 00:24:33 +0800
Subject: [PATCH] Fixed incorrect Content-Length calculation in Upload

The boundaries start with "--", which are missing from size calculation.
---
 src/core/aws-client.adb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/core/aws-client.adb b/src/core/aws-client.adb
index 67a20bfe6..b2a8e2fbb 100644
--- a/src/core/aws-client.adb
+++ b/src/core/aws-client.adb
@@ -1173,10 +1173,11 @@ package body AWS.Client is
       function Content_Length return Stream_Element_Offset is
       begin
          return 2 * Boundary'Length  -- 2 boundaries
-           + 2                       -- second one end with "--"
+           + 4                       -- two boundaries start with "--"
+           + 2                       -- second one ends with "--"
            + 10                      -- 5 lines with CR+LF
-           + CT'Length               -- content length header
-           + CD'Length               -- content disposition head
+           + CT'Length               -- content type header
+           + CD'Length               -- content disposition header
            + File_Size
            + 2;                      -- CR+LF after file data
       end Content_Length;
-- 
2.11.0

Reply via email to