($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Adam Pigg <piggz1@gmail.com>, ofono@lists.linux.dev
Subject: Re: [PATCH v4 1/4] qmimodem: voicecall: Implement call dialing
Date: Thu, 18 Apr 2024 10:03:34 -0500	[thread overview]
Message-ID: <7075d0c8-dca1-40f0-9760-da115f4147fa@gmail.com> (raw)
In-Reply-To: <9B293F2E-E5BC-47AF-AC4F-CD086909A8B7@holtmann.org>

Hi Marcel,

>> What is really needed is a function that takes both src and dst buffer sizes into consideration.  I'm not aware of one.
> 
> strncpy/stpncpy both set the dest to zero, but you are right, it will be
> still off by one. So best is to just zero out the dest buffer with memset
> first and then just copy dest size - 1 at max. Then you get your \0 in
> case of truncation.

Yes, strncpy can work.  You'd need to take a min(dest size - 1, source size), 
strncpy and null terminate.  Verbose and not super readable.

Regards,
-Denis

      reply	other threads:[~2024-04-18 15:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13 21:53 [PATCH v4 1/4] qmimodem: voicecall: Implement call dialing Adam Pigg
2024-04-13 21:53 ` [PATCH v4 2/4] qmimodem: voicecall: Implement call answer Adam Pigg
2024-04-16 18:19   ` Denis Kenzior
2024-04-13 21:53 ` [PATCH v4 3/4] qmimodem: voicecall: Implement active call hangup Adam Pigg
2024-04-16 18:21   ` Denis Kenzior
2024-04-13 21:53 ` [PATCH v4 4/4] qmimodem: voicecall: Implement DTMF tones Adam Pigg
2024-04-16 18:56   ` Denis Kenzior
2024-04-13 22:07 ` [PATCH v4 1/4] qmimodem: voicecall: Implement call dialing Adam Pigg
2024-04-16 18:16 ` Denis Kenzior
2024-04-17 20:38   ` Adam Pigg
2024-04-17 20:54     ` Denis Kenzior
2024-04-18  6:58       ` Marcel Holtmann
2024-04-18 14:41         ` Denis Kenzior
2024-04-18 14:52           ` Marcel Holtmann
2024-04-18 15:03             ` Denis Kenzior [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7075d0c8-dca1-40f0-9760-da115f4147fa@gmail.com \
    --to=denkenz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=ofono@lists.linux.dev \
    --cc=piggz1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).