diff options
| -rw-r--r-- | meta-oe/recipes-support/gd/gd/0001-annotate.c-gdft.c-Replace-strncpy-with-memccpy-to-fi.patch | 46 | ||||
| -rw-r--r-- | meta-oe/recipes-support/gd/gd_2.2.5.bb | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/gd/gd/0001-annotate.c-gdft.c-Replace-strncpy-with-memccpy-to-fi.patch b/meta-oe/recipes-support/gd/gd/0001-annotate.c-gdft.c-Replace-strncpy-with-memccpy-to-fi.patch new file mode 100644 index 0000000000..c377b370e1 --- /dev/null +++ b/meta-oe/recipes-support/gd/gd/0001-annotate.c-gdft.c-Replace-strncpy-with-memccpy-to-fi.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | From 85c7694a5cf34597909bdd1ca6931b0f99904c2e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
| 3 | Date: Tue, 19 Jun 2018 00:40:49 -0700 | ||
| 4 | Subject: [PATCH] annotate.c/gdft.c: Replace strncpy with memccpy to fix | ||
| 5 | -Wstringop-truncation. | ||
| 6 | |||
| 7 | Fixed for gcc8: | ||
| 8 | git/src/gdft.c:1699:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://github.com/libgd/libgd/pull/442] | ||
| 11 | |||
| 12 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
| 13 | --- | ||
| 14 | src/annotate.c | 2 +- | ||
| 15 | src/gdft.c | 2 +- | ||
| 16 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/annotate.c b/src/annotate.c | ||
| 19 | index 00aaf49..17df813 100644 | ||
| 20 | --- a/src/annotate.c | ||
| 21 | +++ b/src/annotate.c | ||
| 22 | @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) | ||
| 23 | fprintf(stderr, "Font maximum length is 1024, %d given\n", font_len); | ||
| 24 | goto badLine; | ||
| 25 | } | ||
| 26 | - strncpy(font, st, font_len); | ||
| 27 | + memcpy(font, st, font_len); | ||
| 28 | } | ||
| 29 | } else if(!strcmp(st, "align")) { | ||
| 30 | char *st = strtok(0, " \t\r\n"); | ||
| 31 | diff --git a/src/gdft.c b/src/gdft.c | ||
| 32 | index 9fa8295..81dbe41 100644 | ||
| 33 | --- a/src/gdft.c | ||
| 34 | +++ b/src/gdft.c | ||
| 35 | @@ -1696,7 +1696,7 @@ static char * font_path(char **fontpath, char *name_list) | ||
| 36 | gdFree(path); | ||
| 37 | return "could not alloc full list of fonts"; | ||
| 38 | } | ||
| 39 | - strncpy(fontlist, name_list, name_list_len); | ||
| 40 | + memcpy(fontlist, name_list, name_list_len); | ||
| 41 | fontlist[name_list_len] = 0; | ||
| 42 | |||
| 43 | /* | ||
| 44 | -- | ||
| 45 | 2.10.2 | ||
| 46 | |||
diff --git a/meta-oe/recipes-support/gd/gd_2.2.5.bb b/meta-oe/recipes-support/gd/gd_2.2.5.bb index 63d9acf05d..62d0df0081 100644 --- a/meta-oe/recipes-support/gd/gd_2.2.5.bb +++ b/meta-oe/recipes-support/gd/gd_2.2.5.bb | |||
| @@ -14,6 +14,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=07384b3aa2e0d39afca0d6c40286f545" | |||
| 14 | DEPENDS = "freetype libpng jpeg zlib tiff" | 14 | DEPENDS = "freetype libpng jpeg zlib tiff" |
| 15 | 15 | ||
| 16 | SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \ | 16 | SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \ |
| 17 | file://0001-annotate.c-gdft.c-Replace-strncpy-with-memccpy-to-fi.patch \ | ||
| 17 | " | 18 | " |
| 18 | 19 | ||
| 19 | SRCREV = "8255231b68889597d04d451a72438ab92a405aba" | 20 | SRCREV = "8255231b68889597d04d451a72438ab92a405aba" |
