Skip to content
Permalink
Browse files Browse the repository at this point in the history
https://github.com/ImageMagick/ImageMagick/issues/1613
  • Loading branch information
Cristy committed Jun 22, 2019
1 parent e92040e commit 29efd64
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions coders/pnm.c
Expand Up @@ -1824,14 +1824,14 @@ static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image,
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u ",ScaleQuantumToLong(index));
extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
if ((q-pixels+extent+2) >= sizeof(pixels))
if ((q-pixels+extent+1) >= sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
}
(void) strncpy((char *) q,buffer,extent);
q+=extent;
p+=GetPixelChannels(image);
}
*q++='\n';
Expand Down Expand Up @@ -1899,14 +1899,14 @@ static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image,
ScaleQuantumToLong(GetPixelGreen(image,p)),
ScaleQuantumToLong(GetPixelBlue(image,p)));
extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
if ((q-pixels+extent+2) >= sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
}
(void) strncpy((char *) q,buffer,extent);
q+=extent;
p+=GetPixelChannels(image);
}
*q++='\n';
Expand Down

0 comments on commit 29efd64

Please sign in to comment.