s3/mdssvc: missing assignment in sl_pack_float
authorRalph Boehme <slow@samba.org>
Sun, 27 Aug 2017 17:22:38 +0000 (19:22 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 25 Oct 2017 06:43:01 +0000 (08:43 +0200)
Spotted by -Werror=maybe-uninitialized:

../source3/rpc_server/mdssvc/marshalling.c: In function ‘sl_pack_float’:
../source3/rpc_server/mdssvc/marshalling.c:171:11: error:
‘ieee_fp_union.w’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  offset = sl_push_uint64_val(buf, offset, bufsize, ieee_fp_union.w);

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12991

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7b58c8f54499f01778bcbfc2ad21521ceed2dd57)

source3/rpc_server/mdssvc/marshalling.c

index 0a02f4187223d3d02b667c05c61a111200652bae..976702c49d4464cb588cd459e87cda999d98a87e 100644 (file)
@@ -164,6 +164,8 @@ static ssize_t sl_pack_float(double d, char *buf, ssize_t offset, size_t bufsize
                uint64_t w;
        } ieee_fp_union;
 
+       ieee_fp_union.d = d;
+
        offset = sl_push_uint64_val(buf, offset, bufsize, sl_pack_tag(SQ_TYPE_FLOAT, 2, 1));
        if (offset == -1) {
                return -1;