[PATCH] Fix compiler warnings in defmod

Dave Lambley dave at lambley.me.uk
Sun Oct 31 16:56:30 GMT 2021


Hello,

> On 28/10/2021 19:32 Steve Fryatt <lists at stevefryatt.org.uk> wrote:
> 
>  
> On 8 Jan, Dave Lambley wrote in message
>     <CAPCK=o9+8AkqhC8DhtxjueoQXmZfD7WUqPMentBohxMwKPWW5Q at mail.gmail.com>:
> 
> > The attached patch resolves warnings picked up by gcc and clang when
> > compiling defmod. It now compiles cleanly on my amd64 machine.
> > 
> > There's a few silly fixes where there's no real problem, but also lots of
> > apparently inadequately sized buffers. Also, lots of pointer casting
> > shenanigans.
> 
> Thanks for these updates, which I've very belatedly got around to looking at
> properly.
> 
> All of the changes look sane, but the updated compile flags stop DefMod
> building at all on my system (Ubuntu 20.04) as GCC is now finding a number
> of potentially undersized sprintf() buffers that it considers to be
> show-stoppers.
> 
> I think the best thing for now is to put the patch into a branch so that
> it's safe, and attempt to keep it up to date with changes on the trunk while
> working through the new errors.
> 
> If anyone else fancies having a look, it's at ^/branches/squash-warnings

I've taken another look at this and got it building cleanly on Ubuntu 20.04 (with gcc 9.3.0). I have added checks against buffer overflows and enlarged a couple of buffers to prevent overflow. A patch is attached, it should be applied on top of the patch in branch "squash-warnings".

Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buffer_checks.patch
Type: text/x-patch
Size: 10572 bytes
Desc: not available
URL: <https://lists.compton.nu/pipermail/oslib-user/attachments/20211031/11ce5725/attachment.bin>


More information about the oslib-user mailing list