rpms/nntpgrab/F-7 nntpgrab-0.2-nntp-plugin-off-by-one-fix.patch, NONE, 1.1 nntpgrab.spec, 1.3, 1.4

Erik van Pienbroek (epienbro) fedora-extras-commits at redhat.com
Tue Feb 5 17:02:40 UTC 2008


Author: epienbro

Update of /cvs/pkgs/rpms/nntpgrab/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15395/F-7

Modified Files:
	nntpgrab.spec 
Added Files:
	nntpgrab-0.2-nntp-plugin-off-by-one-fix.patch 
Log Message:
Added a patch to fix an off-by-one error


nntpgrab-0.2-nntp-plugin-off-by-one-fix.patch:

--- NEW FILE nntpgrab-0.2-nntp-plugin-off-by-one-fix.patch ---
--- branches/nntpgrab-0.2/plugins/nntp/nntp.c	2008/02/02 21:05:38	565
+++ branches/nntpgrab-0.2/plugins/nntp/nntp.c	2008/02/05 16:51:15	566
@@ -765,7 +765,6 @@
 nntpgrab_plugin_nntp_get_article_by_message_id(int conn_id, const char *message_id, const char **headers, const char *filename, gpointer cb_data)
 {
     char *line;
-    char *newline_pos;
     char *ptr;
     int fp;
     int length;
@@ -775,6 +774,7 @@
     struct timeval prev_stamp;
     char write_buffer[128 * 1024];      // Save the data for every 128KB data received
     int write_buffer_len;
+    int i;
 
     if (headers) {
         g_error(__FILE__":%i fetching of headers not yet implemented!\n", __LINE__);
@@ -970,14 +970,11 @@
     // Do we need to un-escape any double-dots ?
     ptr = g_mapped_file_get_contents(file);
     length = g_mapped_file_get_length(file);
-    newline_pos = strstr(ptr, "\n");
-    while (newline_pos) {
-        if (newline_pos[0] == '\n' && newline_pos[1] == '.' && newline_pos[2] == '.') {
-            char *begin = ptr;
-            memmove(newline_pos + 1, newline_pos + 2, length - (newline_pos - begin) - 1);
+    for (i = 0; i < length - 3; i++) {
+        if (ptr[i] == '\n' && ptr[i + 1] == '.' && ptr[i + 2] == '.') {
+            memmove(ptr + i + 1, ptr + i + 2, length - i - 2);
             length -= 1;
         }
-        newline_pos = strstr(newline_pos + 1, "\n");
     }
 
     g_file_set_contents(filename, ptr, length, NULL);


Index: nntpgrab.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nntpgrab/F-7/nntpgrab.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- nntpgrab.spec	2 Feb 2008 21:40:51 -0000	1.3
+++ nntpgrab.spec	5 Feb 2008 17:02:04 -0000	1.4
@@ -5,6 +5,7 @@
 License: GPLv2+
 Group: Applications/Internet
 Source: http://www.nntpgrab.nl/releases/nntpgrab-%{version}.tar.bz2
+Patch0: nntpgrab-0.2-nntp-plugin-off-by-one-fix.patch
 
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL: http://www.nntpgrab.nl
@@ -76,6 +77,7 @@
 
 %prep
 %setup -q
+%patch0 -p2
 
 %build
 %configure
@@ -143,8 +145,9 @@
 %{_libdir}/pkgconfig/nntpgrab.pc
 
 %changelog
-* Sat Feb 1 2008 Erik van Pienbroek <info at nntpgrab.nl> - 0.2.3-1
+* Tue Feb 5 2008 Erik van Pienbroek <info at nntpgrab.nl> - 0.2.3-1
 - Update to 0.2.3. Fixes regression in 0.2.2
+- Added a patch to fix an off-by-one error
 
 * Sun Jan 27 2008 Erik van Pienbroek <info at nntpgrab.nl> - 0.2.2-1
 - Update to 0.2.2, bugfix release which should solve some




More information about the fedora-extras-commits mailing list