* Fixed some more of the things that broke in r8201.
authorArt Cancro <ajc@citadel.org>
Sat, 16 Jan 2010 22:49:46 +0000 (22:49 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 16 Jan 2010 22:49:46 +0000 (22:49 +0000)
  NOTE: fread() returns the number of BLOCKS read, not the number of BYTES read.

citadel/modules/network/serv_network.c

index c900731ed582ee8646edf1bde0006068c62ffa69..5740feaa045534cdefd88d5add734ab1a04139c4 100644 (file)
@@ -511,7 +511,7 @@ void network_deliver_digest(SpoolControl *sc) {
        msg->cm_fields['M'] = malloc(msglen + 1);
        fseek(sc->digestfp, 0L, SEEK_SET);
        siz = fread(msg->cm_fields['M'], (size_t)msglen, 1, sc->digestfp);
-       msg->cm_fields['M'][siz] = '\0';
+       msg->cm_fields['M'][msglen] = '\0';
 
        fclose(sc->digestfp);
        sc->digestfp = NULL;
@@ -1897,7 +1897,7 @@ void receive_spool(int sock, char *remote_nodename) {
                                        plen = sizeof buf;
                                }
                                siz = fread(buf, plen, 1, fp);
-                               fwrite(buf, siz, 1, newfp);
+                               fwrite(buf, plen, 1, newfp);
                                bytes_copied += plen;
                        }
                        fclose(newfp);