https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88993
--- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #3) > Rather than warning about this the bugs should be fixed, there is no reason > why glibc needs to malloc memory for these cases. I completely agree. The warning is bogus. In any case, the trigger point is much too low. > For "%.65535s" I don't > actually see where it would allocate memory, I see memory allocations when > it has to convert between wide and narrow strings or vice versa, for either > of these cases it is enough to put a max cap on the buffer size and just > handle it piecewise rather than all in one go. There's a patch for that: https://patchwork.sourceware.org/patch/21106/ It needs to be rebased to current master (and perhaps adjusted to use an overflow-checking builtin).