|Re: [hatari-devel] Patch to fix crash saving midi preferences on Mac|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Patch to fix crash saving midi preferences on Mac
- From: Chris Jenkins <cdpjenkins@xxxxxxxxx>
- Date: Sat, 28 May 2022 18:41:53 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=sJl+i3GpxfRDf1rMKBKsrCU+KUGCUGil71KO6J3c6nI=; b=cVISXyAg5klW8ecn1aqjYU8X2GNaRyNwCKD6U3XBBdUtUc4hzut3aJekn7pHUzI1Fn fDkQnXwcoZDABCyjem4NQYqNl+VUiVpLC/ODsheVLpI6YhSJC6iX+RjQC8t4lCtkkwJ3 Y13rGMhKV2NN5wmgAbcsW8reqqPkzYlgggvNuUy1+uOSnbZhZYlEZkkW6GMfaY+jqjxq AJmDgFZb5BKm4DBR6WOa2LBo0/tOwOFG7wAPO0IZ2JvqoZ1Dk5oGaxuy+0Wnu30jtfPF H8RSHcNFiTzrISVuk7Z4ZOnV+PUqnlPXxA8rhtqZKofifPTuiIPEhQeacgvJVVMEAxYj tb9A==
That means strncpy always fills the whole destination buffer - using \0 if
the source string is not long enough.
Many thanks for explaining. My C is incredibly rusty (I last wrote C for a living in like 2004) so it's really good for me to learn about it. I guess what was happening is that it was writing null characters past the end of the buffer and overwriting something that the Apple C library was able to detect.