Message ID | 20180517233105.8243-2-bsingharora@gmail.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40n6yX3YX5z9s1w for <incoming@patchwork.ozlabs.org>; Fri, 18 May 2018 09:31:48 +1000 (AEST) 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="VzajmkQZ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40n6yX1rLRzF294 for <incoming@patchwork.ozlabs.org>; Fri, 18 May 2018 09:31:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VzajmkQZ"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::22e; helo=mail-pg0-x22e.google.com; envelope-from=bsingharora@gmail.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VzajmkQZ"; dkim-atps=neutral Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40n6y15WK3zF26D for <skiboot@lists.ozlabs.org>; Fri, 18 May 2018 09:31:21 +1000 (AEST) Received: by mail-pg0-x22e.google.com with SMTP id k2-v6so2490507pgc.1 for <skiboot@lists.ozlabs.org>; Thu, 17 May 2018 16:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=icqNr9kSUv5RHiLSq//hDt3j9CGGBAdVVuTP9HNyFBQ=; b=VzajmkQZ+G0f/cg0+UMJdgXHCxWYhP40UOiljmjU72Ln54AlI9jEXlSw6gf7SYv8bF Nwi7S96dv9CtTJMU+YeId42atGWm/JF5aSqpYCuR8az/CptYep3Jiuo+jeLzYHv/qN4q RsEv7HK9kSX9/k3HO5YrjoC9V4Wv1hOoNcmvpFGb6rcfYuqvU2HtLx7jCZ0rfw71TjCd jhTa7iLJkz9dw/oBFGtndHBHc6CVExwApghCvNetq618tKecqlBBJnXVJsgQbcWCNAl3 g1pOJtrYQjG1vpvKRDUSwxztoTd8HPb0dfdNYrWRS4eAMao49dEABwg44JteSAGnrdTq 8exw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=icqNr9kSUv5RHiLSq//hDt3j9CGGBAdVVuTP9HNyFBQ=; b=kFhRtG6noLfYSc7DEVzodo2w+TYBEKaVTlTbDDzBahO6rfBwXZ4Efe/Yc/5fdN+uvu CeZCADY/h6Ig/N54zo/Je81GWRhrUaP4T9vbMFW12Repsdcvr2hkhvCIITfJRRd315P7 TyyFCPwrLaasfmqTI8KAdFYAqachkZpfVwFYwoDeSIIj3T6X9xvOMwrQ+qLsndEzghJp tH823TD2a6cKK9zFof88Pm04BPmN+F07wpRYqHSzpAQM7xwM2pUCKImuLxmeUBfKhsYw ghZwse+v+bhJSs6TD2BoH0Jnlz29uuJfpIzWstcu+HhCsw0NpgzCje4xR+VWfG6Xl98D +npQ== X-Gm-Message-State: ALKqPwfnTgmD5QKxf8LQ6USElMDWueZM87mB4f02nKE2m2ELjUqT6Mum T2k/MAJbDOt/JKKtVSZCUicyIVoD X-Google-Smtp-Source: AB8JxZrUT5EZl0JF6PCPpC3ksa+d2tNfbHp9G8n+CXaIl1XN25h/TSZj6Y5EgHuu7UIC23nr3lXzvA== X-Received: by 2002:a63:6ec6:: with SMTP id j189-v6mr5456759pgc.71.1526599878330; Thu, 17 May 2018 16:31:18 -0700 (PDT) Received: from localhost.localdomain (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.gmail.com with ESMTPSA id q76-v6sm12805990pfi.139.2018.05.17.16.31.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 16:31:17 -0700 (PDT) From: Balbir singh <bsingharora@gmail.com> To: skiboot@lists.ozlabs.org Date: Fri, 18 May 2018 09:31:00 +1000 Message-Id: <20180517233105.8243-2-bsingharora@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517233105.8243-1-bsingharora@gmail.com> References: <20180517233105.8243-1-bsingharora@gmail.com> Subject: [Skiboot] [PATCH 1/6] Fix strtok for previous tokens being NULL X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development <skiboot.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/skiboot>, <mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/skiboot/> List-Post: <mailto:skiboot@lists.ozlabs.org> List-Help: <mailto:skiboot-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/skiboot>, <mailto:skiboot-request@lists.ozlabs.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" <skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> |
Series |
scan build fixes
|
expand
|
diff --git a/libc/string/strtok.c b/libc/string/strtok.c index 665c08db..aa42d77e 100644 --- a/libc/string/strtok.c +++ b/libc/string/strtok.c @@ -18,8 +18,11 @@ strtok(char *src, const char *pattern) static char *nxtTok; char *retVal = NULL; - if (!src) + if (!src) { src = nxtTok; + if (!src) + return retVal; + } while (*src) { const char *pp = pattern;
Caught by scan-build. If the stored token nxtTok is already NULL, don't dereference src Signed-off-by: Balbir singh <bsingharora@gmail.com> --- libc/string/strtok.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)