diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c index 1ef8549740..3cbf23f9aa 100644 --- a/plug-ins/common/file-dicom.c +++ b/plug-ins/common/file-dicom.c @@ -841,7 +841,8 @@ dicom_add_element (GSList *elements, element->group_word = group_word; element->element_word = element_word; - strncpy (element->value_rep, value_rep, sizeof (element->value_rep)); + strncpy (element->value_rep, value_rep, sizeof (element->value_rep) - 1); + element->value_rep[sizeof (element->value_rep) - 1] = '\0'; element->element_length = element_length; element->value = value; @@ -1062,7 +1063,8 @@ dicom_get_elements_list (gint32 image_ID) guint16 element_word = 0; /* sacrificial buffer */ - strncpy (buf, parasites[i], sizeof (buf)); + strncpy (buf, parasites[i], sizeof (buf) - 1); + buf[sizeof (buf) - 1] = '\0'; /* buf should now hold a string of the form * dcm/XXXX-XXXX-AA where XXXX are Hex values for @@ -1105,7 +1107,10 @@ dicom_get_elements_list (gint32 image_ID) /* and lastly, the VR */ if (ptr1) - strncpy (value_rep, ptr1, sizeof (value_rep)); + { + strncpy (value_rep, ptr1, sizeof (value_rep) - 1); + value_rep[sizeof (value_rep) - 1] = '\0'; + } /* * If all went according to plan, we should be able diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c index a1beed58a4..ca42c273df 100644 --- a/plug-ins/common/file-ps.c +++ b/plug-ins/common/file-ps.c @@ -3581,7 +3581,7 @@ load_dialog (const gchar *filename) range = gimp_page_selector_get_selected_range (GIMP_PAGE_SELECTOR (selector)); } - strncpy (plvals.pages, range, sizeof (plvals.pages)); + strncpy (plvals.pages, range, sizeof (plvals.pages) - 1); plvals.pages[strlen (range)] = '\0'; ps_pagemode = gimp_page_selector_get_target (GIMP_PAGE_SELECTOR (selector)); @@ -3592,8 +3592,7 @@ load_dialog (const gchar *filename) } else { - strncpy (plvals.pages, "1", 1); - plvals.pages[1] = '\0'; + strncpy (plvals.pages, "1", sizeof (plvals.pages) - 1); ps_pagemode = GIMP_PAGE_SELECTOR_TARGET_IMAGES; } diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c index 18f7593d66..f62db7883f 100644 --- a/plug-ins/file-sgi/sgi.c +++ b/plug-ins/file-sgi/sgi.c @@ -458,8 +458,8 @@ load_image (const gchar *filename, for (i = 0; i < sgip->zsize; i ++) if (sgiGetRow (sgip, rows[i], sgip->ysize - 1 - y, i) < 0) - g_printf ("sgiGetRow(sgip, rows[i], %d, %d) failed!\n", - sgip->ysize - 1 - y, i); + g_printerr ("sgiGetRow(sgip, rows[i], %d, %d) failed!\n", + sgip->ysize - 1 - y, i); if (sgip->bpp == 1) { diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c index 7ac25b045f..48fb0f853b 100644 --- a/plug-ins/gradient-flare/gradient-flare.c +++ b/plug-ins/gradient-flare/gradient-flare.c @@ -4986,6 +4986,7 @@ gradient_cache_lookup (const gchar *name, gradient_cache_zorch(); ci = g_new (GradientCacheItem, 1); strncpy (ci->name, name, GRADIENT_NAME_MAX - 1); + ci->name[GRADIENT_NAME_MAX - 1] = '\0'; ci->next = gradient_cache_head; ci->prev = NULL; if (gradient_cache_head)