Quellcode durchsuchen

If the buffer size is 0 in buffer_copy, then return, and do nothing.

Adam Heath vor 25 Jahren
Ursprung
Commit
0bd125e548
2 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen
  1. 6 1
      ChangeLog
  2. 2 0
      lib/mlib.c

+ 6 - 1
ChangeLog

@@ -1,4 +1,9 @@
-Wed Apr 18 13:15:08 CDT 2001 Adam Heath <doogie@debian.org>
+Wed Apr 18 23:42:16 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * lib/mlib.c: If the buffer size is 0 in buffer_copy, then return, and
+    do nothing.
+
+Wed Apr 18 23:42:16 CDT 2001 Adam Heath <doogie@debian.org>
 
   * configure.in, debian/control: New upstream gettext.  Since we had
     to change our build, to comply with the new upstream, we also

+ 2 - 0
lib/mlib.c

@@ -264,6 +264,8 @@ ssize_t buffer_copy(buffer_data_t read_data, buffer_data_t write_data, ssize_t l
   int bufsize= 32768;
   ssize_t totalread= 0, totalwritten= 0;
   if((limit != -1) && (limit < bufsize)) bufsize= limit;
+  if(bufsize == 0)
+    return 0;
   writebuf= buf= malloc(bufsize);
   if(buf== NULL) ohshite(_("failed to allocate buffer in buffer_copy (%s)"), desc);