Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 7 Jul 2017 22:53:34 +0300
From: Evgeni Stebaev <js@...ect.lv>
To: musl@...ts.openwall.com
Subject: Different scanf behaviour compared to glibc

Hi!

sscanf returns 0 for the following code using musl, but glibc returns 1.
%15s cannot be used here since it stops on whitespace, but it's required to
get all remaining data after getting other fields with sscanf (not included
in this example).

#include <stdio.h>
#include <string.h>

int main(void) {
  char data[16];
  memset(data, '\0', sizeof(data));
  int res = sscanf("abcde", "%15c", data);
  printf("parse: %d %s\n", res, data);
  return 0;
}

Content of type "text/html" skipped

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.