[Bug 1658715] [NEW] swprintf return incorrect number of characters written when writing to NULL and 0 length

TommyBoy tom_launchpad at yahoo.com
Mon Jan 23 15:41:09 UTC 2017


Public bug reported:

Expected behavior:

int test = 5;
wchat_t* buff = NULL;
size_t strlen = swprintf(buff ,0 , L"%d", test);

In this instance I would expect strlen = 1;

-----------------------------------

Actual behavior:

strlen =  18446744073709551615

-----------------------------------
Extra Info:
apt-cache policy libc6
libc6:
  Installed: 2.23-0ubuntu5
  Candidate: 2.23-0ubuntu5
  Version table:
 *** 2.23-0ubuntu5 500
        500 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.23-0ubuntu3 500
        500 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

-----------------------------------
lsb_release -rd
Description:	Ubuntu 16.04.1 LTS
Release:	16.04

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1658715

Title:
  swprintf return incorrect number of characters written when  writing
  to NULL and 0 length

Status in glibc package in Ubuntu:
  New

Bug description:
  Expected behavior:

  int test = 5;
  wchat_t* buff = NULL;
  size_t strlen = swprintf(buff ,0 , L"%d", test);

  In this instance I would expect strlen = 1;

  -----------------------------------

  Actual behavior:

  strlen =  18446744073709551615

  -----------------------------------
  Extra Info:
  apt-cache policy libc6
  libc6:
    Installed: 2.23-0ubuntu5
    Candidate: 2.23-0ubuntu5
    Version table:
   *** 2.23-0ubuntu5 500
          500 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
          100 /var/lib/dpkg/status
       2.23-0ubuntu3 500
          500 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

  -----------------------------------
  lsb_release -rd
  Description:	Ubuntu 16.04.1 LTS
  Release:	16.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1658715/+subscriptions



More information about the foundations-bugs mailing list