From owner-freebsd-arch@freebsd.org Wed May 25 21:26:04 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92A3DB4ADFE for ; Wed, 25 May 2016 21:26:04 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60E251CD6 for ; Wed, 25 May 2016 21:26:04 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-it0-x229.google.com with SMTP id z189so71450753itg.0 for ; Wed, 25 May 2016 14:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=2ffgCJVE5+Uuqtgj/Y7Fq/FawQS7mkN3CvDOA5uGXDs=; b=BgVObw8sgJwpP4bYM06tXu8niuINyIrRypqMGiB0gd5WmrnsQrfqnD6VWL6UBldRem mjaY1zoDMEN8IXJtxvso9tcdTVLU7HSf7yIoJC66TPoY2IT+iPrVJwLfqC/m3Bl2xxPa 2xchFkhAEZaLTHycQwfzS5K5P3aWMQd8XR9nqVok7WNLuZe1amYsP/FG5yzy1fzXomDX rtQs4xwioSZnr96/v7AkLIQJK6KG7cUiFYGLRzy3TzIefdYDUbJZ6fasxN0fb5J4c6Or rO6HgElvesHtp8/HGKJUZup4K+m9ni60cf1v+2KsfzANObwxGlkaIWvTXZEuiKLbKAws PeyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=2ffgCJVE5+Uuqtgj/Y7Fq/FawQS7mkN3CvDOA5uGXDs=; b=Ssi7eiB3ZnESpmtsheYR98yAjd6nKVFuYtvTy46OmMS6D4rqECDmjxnhRW7bVfvC+q HMcz/XSyAyICY9A400X7VuUMFa4NXeJ9xr4syjPW0CdX1XFsIefiejqTDxiTAutPaDYp wfNsYjmg+ESFMzsIG182GdXWAR2amrYtAGeQ6gGUaebG/3cklBWJa3XYaX/o4oePOk/Z hnXkg5AJhf19BAvDc45jNhxzwCpcQh9GhswprXAAJHOv5Pt6W2hBH9+RWhybJtkRmOPj Jq06VOCkBxHpZ2zGGIkSF/5G45tbvDnzNEm3Tx1w81xHkVh9FmvMKi6LeBHP/OEGHpRd qDxA== X-Gm-Message-State: ALyK8tKqprusi4yIHlAkZKAFuhCSNwiWT/EHp9smROtW/ZgDnTrhYe64ZsVHChnJMhBVInBBIl7PKe+ihCB/tw== MIME-Version: 1.0 X-Received: by 10.129.56.68 with SMTP id f65mr3878139ywa.240.1464211563395; Wed, 25 May 2016 14:26:03 -0700 (PDT) Received: by 10.13.201.199 with HTTP; Wed, 25 May 2016 14:26:03 -0700 (PDT) In-Reply-To: <201605252114.u4PLE1NA007337@gw.catspoiler.org> References: <201605252114.u4PLE1NA007337@gw.catspoiler.org> Date: Wed, 25 May 2016 23:26:03 +0200 Message-ID: Subject: Re: is ut_user[] in struct utmpx NUL terminated? From: Ed Schouten To: Don Lewis Cc: freebsd-arch@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 21:26:04 -0000 Hi Don, 2016-05-25 23:14 GMT+02:00 Don Lewis : > Going in the other direction, getutxent() > calls futx_to_utx(), which uses the FTOU_STRING() macro, which in turn > uses strncpy() to copy the data back out. Keep in mind that strcpy() is called with a size that is at most one less than sizeof(ut->ut_user). The final byte in the array is never overwritten. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717