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

Bug #1658715 reported by TommyBoy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
New
Undecided
Unassigned

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 post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.