Public bug reported:

The function sscanf() fails to read the correct value of a long integer.

The C code below shows the bug. Just put it in a file and compile using 
gcc. 

//-------------------------
#include <stdlib.h>
#include <stdio.h>


int main(int argc, char ** argv)
{
  char buf1[1024];
  char buf2[32];
  unsigned long long int *u64=(unsigned long long int *)&buf2;
  char *buffer=buf1;

  printf("sscanf() bug???\n");

  sprintf(buffer,"%llu \n",0xf0debc9a78563412LL);
  printf("content of buffer: <<<%s>>>\n",buffer);
  sscanf(buffer,"%lld",u64);
  printf("content of u64: 0x%llx\n",*u64);
  printf("content should be: 0xf0debc9a78563412\n");
  exit(0);
}
//-------------------------

Regards.
Ric.

ProblemType: Bug
Architecture: i386
Dependencies:
 libgcc1 1:4.3.3-5ubuntu4
 gcc-4.3-base 4.3.3-5ubuntu4
 findutils 4.4.0-2ubuntu4
 libc6 2.9-4ubuntu6
DistroRelease: Ubuntu 9.04
NonfreeKernelModules: nvidia
Package: libc6 2.9-4ubuntu6
ProcEnviron:
 PATH=(custom, user)
 LANG=pt_BR.UTF-8
 SHELL=/bin/bash
SourcePackage: glibc
Uname: Linux 2.6.28-13-generic i686

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


** Tags: apport-bug i386

-- 
Bug in sscanf() function reading 64 bits integer
https://bugs.launchpad.net/bugs/392681
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to