]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: fix warning in fprintf() code
authorMike Frysinger <vapier@gentoo.org>
Mon, 12 Jan 2009 16:08:07 +0000 (11:08 -0500)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 13 Jan 2009 11:05:28 +0000 (13:05 +0200)
When building with gcc security warnings enabled, the ubimirror.c code
triggers this warning:
./src/ubimirror.c: In function 'main':
./src/ubimirror.c:206: error: format not a string literal and no format arguments

Since the buffer in question should be a straight string anyways, avoid
ugly printf exploits by outputting the string indirectly:
printf("%s", buffer)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/src/ubimirror.c

index 2cc4596dea4797372af0c01117bef68a29381da4..a20e1af7fecc629f261f90d2b076d17f4fe4f153 100644 (file)
@@ -203,7 +203,7 @@ main(int argc, char **argv) {
                       err_buf, sizeof(err_buf));
        if( rc ){
                err_buf[sizeof err_buf - 1] = '\0';
-               fprintf(stderr, err_buf);
+               fprintf(stderr, "%s", err_buf);
                if( rc < 0 )
                        rc = -rc;
        }