[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04
From: |
Adrian Bunk |
Subject: |
gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04 |
Date: |
Sun, 8 Mar 2020 13:19:35 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
rpl_fprintf is wrongly being used on Ubuntu 18.04 due to:
$ cat test.c
/* gl_PRINTF_DIRECTIVE_N */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char fmtstring[10];
static char buf[100];
int main ()
{
int count = -1;
/* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
support %n in format strings in read-only memory but not in writable
memory. */
strcpy (fmtstring, "%d %n");
if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
|| strcmp (buf, "123 ") != 0
|| count != 4)
return 1;
return 0;
}
$ gcc -O2 test.c -o test && ./test
*** %n in writable segment detected ***
Aborted
$
cu
Adrian
- gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04,
Adrian Bunk <=
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Bruno Haible, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Adrian Bunk, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Bruno Haible, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Adrian Bunk, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Bruno Haible, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Paul Eggert, 2020/03/08
- Re: gl_{,SN}PRINTF_DIRECTIVE_N wrongly fail on Ubuntu 18.04, Bruno Haible, 2020/03/16