lex_get_text_buffer_read: Avoid potential buffer overflow.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Jan 2012 06:47:58 +0000 (07:47 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Jan 2012 07:27:27 +0000 (08:27 +0100)
src/ui/gui/psppire-lex-reader.c

index 5afd10158beab236e749673e0573b4fd367e0e3c..ae043b0b7b252cedea40bf1634a0895aad20f748 100644 (file)
@@ -81,7 +81,7 @@ lex_gtk_text_buffer_read (struct lex_reader *r_, char *buf, size_t n,
 
   s = gtk_text_iter_get_text (&r->start, &iter);
 
-  strcpy (buf, s);
+  strncpy (buf, s, n_chars);
 
   r->start = iter;