On Sat, Feb 25, 2023 at 02:40:52PM +0100, Sören Tempel wrote: > This solution also has the issue that it handles the case incorrectly > where xstrncpy actually calls strlen(3). I wanted to avoid that but > maybe the best solution is to just change the xstrncpy API in a way that > it indicates whether it has written anything through an int return > value? The best will be to avoid all the buffer, xstrndup(), and mnt_optstr_get_option() using if the options string or the pattern is empty. It's unnecessary because we know that mnt_optstr_get_option() will return nothing. I have committed https://github.com/util-linux/util-linux/commit/06ee5267516761721ebfbdfa313980cef8e54c66 > Sorry for all the noise. Next time, I will just write a bug report... That's no problem. We should be friendly to people who invest time to report bugs and write code ;-) Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com