From patchwork Mon Oct 7 22:57:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 1173000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=uclibc.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=uclibc-bounces@uclibc.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bMCjPSzC"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nG8j6rNVz9sPT for ; Tue, 8 Oct 2019 09:57:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 20F8487BD7; Mon, 7 Oct 2019 22:57:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H6oawkDeSA90; Mon, 7 Oct 2019 22:57:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 64D3D87B9B; Mon, 7 Oct 2019 22:57:36 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 940A71BF2C6 for ; Mon, 7 Oct 2019 22:57:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8D6B121539 for ; Mon, 7 Oct 2019 22:57:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y3vSdXRKxpWf for ; Mon, 7 Oct 2019 22:57:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by silver.osuosl.org (Postfix) with ESMTPS id BAAA92036B for ; Mon, 7 Oct 2019 22:57:34 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id 23so9118756pgk.3 for ; Mon, 07 Oct 2019 15:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=8lqYzKrCcGX8Ts/S8249ihbyjpCA59J5S9VmOgsvL/g=; b=bMCjPSzC99KPvFkMOqlqansn7WxpMd85d/UPlDBM/kqqnYasHN2Wxq95rodVX4knq5 5T7g8/Wmh3LAii6rHAFxuGAxQgkI1kkeBNPaVM+hbB2pSgj6zhruzOvWZet6LGR8mvBc z34/v1c9JAsgr3Lm0n4tWyfVihDGhpKf+O+ZIyoOvRdcwVGhdJ7aekS9zMJbdlbdubRN wxpjp5HZW1JOlDqx2IF1jangVa2cTIuUcshd62df5AxjE7AQJHH71B5qsH/8jpSJUeb7 /mHfxbv8xarIeX1ZoFD/DWL5iaBhYC2x4NJmmI6up9Sr/wwZLi7GeBlHFtj6LuF2GgrK 076g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=8lqYzKrCcGX8Ts/S8249ihbyjpCA59J5S9VmOgsvL/g=; b=pOqr8RK/eLQFCoB5XcjaRMctHBHEB8ZcAgtPc5m7bA2QkTi2clvLbwGWd17T5Mg3q5 oGgVVr0w0YYU1iEpeS4ex5BhU0U73DcKNU+ZtUwfHuc6TzFb79otm+okTUbS26w5rpiS hhDxXOSMmS/TjGgiXdJaK4nR+4AXgKjsRnKnHFXxM0OJ3KHVZvD8d9faUbHWm5TDKOOf WOYOaIMYAMB4YqsVp7MztaRWMjIsvbt7EAO2E6fpQnzPD5xicTN3c9ZLbtJCaqbFHzea XIEweqMxVFG3hOIdg1YLxox8Svo706NiS75IoIPoCnP+h0xEP+SSP3cuSMzKR+HvaHV2 CdLg== X-Gm-Message-State: APjAAAVvtE5WXlx7XEQ5+cGbcPeOkLAnRi8Yi3I52xSttRX3PY8wvlF0 nnhau0/09h9majKkNaHosRzxDCjR X-Google-Smtp-Source: APXvYqw9BJfH+RMmklNWJzGsQbWiZ0eQlWos6cExkajxq28d08HJJsZeTXh8Dlc9or3YoEfbPeqngA== X-Received: by 2002:a17:90a:a60f:: with SMTP id c15mr1968554pjq.18.1570489053937; Mon, 07 Oct 2019 15:57:33 -0700 (PDT) Received: from localhost.localdomain ([69.42.0.147]) by smtp.gmail.com with ESMTPSA id r24sm15323685pfh.69.2019.10.07.15.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 15:57:33 -0700 (PDT) From: Rosen Penev To: uclibc@uclibc.org, rep.dot.nop@gmail.com Subject: [PATCH] istream_helpers: Fix sscanf typo Date: Mon, 7 Oct 2019 15:57:32 -0700 Message-Id: <20191007225732.12571-1-rosenp@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" This caused readin not to work properly with long long types. Found accidentally through a glibc warning (declared with warn_unused_result). Tested with gptfdisk on OpenWrt. Signed-off-by: Rosen Penev --- include/istream_helpers | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/istream_helpers b/include/istream_helpers index f2c793f..f8db903 100644 --- a/include/istream_helpers +++ b/include/istream_helpers @@ -317,7 +317,7 @@ namespace std{ sscanf(temp.c_str(), "%llo", (unsigned long long *)&var ); }else if(stream.flags() & ios_base::hex){ if(stream.flags() & ios_base::uppercase){ - scanf(temp.c_str(), "%llX", (unsigned long long *)&var ); + sscanf(temp.c_str(), "%llX", (unsigned long long *)&var ); }else{ sscanf(temp.c_str(), "%llx", (unsigned long long *)&var); } @@ -344,7 +344,7 @@ namespace std{ sscanf(temp.c_str(), "%llo", &var ); }else if(stream.flags() & ios_base::hex){ if(stream.flags() & ios_base::uppercase){ - scanf(temp.c_str(), "%llX", &var ); + sscanf(temp.c_str(), "%llX", &var ); }else{ sscanf(temp.c_str(), "%llx", &var); }