From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11693 Path: news.gmane.org!.POSTED!not-for-mail From: Evgeni Stebaev Newsgroups: gmane.linux.lib.musl.general Subject: Different scanf behaviour compared to glibc Date: Fri, 7 Jul 2017 22:53:34 +0300 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1145171aa17e810553bf967c" X-Trace: blaine.gmane.org 1499457231 2272 195.159.176.226 (7 Jul 2017 19:53:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Jul 2017 19:53:51 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11706-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jul 07 21:53:46 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dTZJy-0000JG-23 for gllmg-musl@m.gmane.org; Fri, 07 Jul 2017 21:53:46 +0200 Original-Received: (qmail 7474 invoked by uid 550); 7 Jul 2017 19:53:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7435 invoked from network); 7 Jul 2017 19:53:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=direct-lv.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=q1+RjuiCpN6ogy21t/aoKC2GAz0gQK/LiQbHu2MKIs0=; b=15Q0tm9WFQGOephrIN22qZZBOhP9uMEXJ4Co4jCIAfORvlQIMOgmk54ISDHILDa7qB uJhqJ6QQPEMAdCDTPZdkIic4IUc2Fva/cJ9Q01dV2sxFhaSXbJtGTaDnnD31WjQBDydF KSIDnGZohqPsvu8rSci9YvARAf6gjdhBrZwbYDGcA2zZGlMOPhTuZq9pJBdCXQH4aY9Y +3VRh/YIlRo4aEUlnwC4asHyIoOy5lSS5PmG2rVS8czBgfCS3c93U7PPB2oHRd3gKQVH gZ8KUJBqZ0GuEjREUXCiz6T0jl4qfqTXNaaFV3buvCNrcLmtwzYIiSi1qW3mUUUS8VoO EJbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=q1+RjuiCpN6ogy21t/aoKC2GAz0gQK/LiQbHu2MKIs0=; b=htGEAmG6/pxQRfXmKL7hAbABt2l4BbFZEqa8abCmn3cA+86kfNv2k0wtQMnVfoerPf 1WTc5RHYRqliP08MH+SWuXHWUQ5UOPmHh/o8yNdZAH3NBf4aRh3DW5texhJAtxv29rV3 /QmBRm97CnuyWMocr+3tPchsQhGfoSEbpNw+ZOBi9qZ2SMnXYYVjIr8SNj/GMU5RBbXB hxkYDMLWU/pkmA/BfTnAgfYO3XUIc7guGo1zko7l5rXiPztO7mUv+MkHrQpNhbFpclqt 2S+7jZGerE3y/BFpdVYrWxmLvICDpxd9B6cFZJ9Cv5tbGtmBZxf72UXW0J6lb+e3gntN BwnA== X-Gm-Message-State: AIVw110kSpnZSPxjeF3f4CNffqeADbodUy0AL34ppnyBT4Vx+n2eCyN9 CaXf9kvkiD8qIlCLw8krLCXLZ0gs2wJBt0JA+A== X-Received: by 10.31.129.2 with SMTP id c2mr1647740vkd.11.1499457214571; Fri, 07 Jul 2017 12:53:34 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:11693 Archived-At: --001a1145171aa17e810553bf967c Content-Type: text/plain; charset="UTF-8" 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 #include 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; } --001a1145171aa17e810553bf967c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

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

#include <stdi= o.h>
#include <string.h>

int main(void) {
=C2=A0 char= data[16];
=C2=A0 memset(data, '\0', sizeof(data));
=C2=A0 in= t res =3D sscanf("abcde", "%15c", data);
=C2=A0 prin= tf("parse: %d %s\n", res, data);
=C2=A0 return 0;
}

=
--001a1145171aa17e810553bf967c--