* more buffer size stuff
authorArt Cancro <ajc@citadel.org>
Sat, 30 Dec 2000 04:55:06 +0000 (04:55 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 30 Dec 2000 04:55:06 +0000 (04:55 +0000)
13 files changed:
citadel/ChangeLog
citadel/citmail.c
citadel/citserver.c
citadel/clientsocket.c
citadel/commands.c
citadel/ipc_c_tcp.c
citadel/msgbase.c
citadel/netsetup.c
citadel/rooms.c
citadel/sendcommand.c
citadel/serv_bio.c
citadel/support.c
citadel/sysdep.c

index bd410dd3f91101d1f930fc702e549ca87e1eed0a..d3b3d1f72ef38ee7a97242e61c7df4abe56178a4 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.60  2000/12/30 04:55:05  ajc
+ * more buffer size stuff
+
  Revision 573.59  2000/12/27 20:19:51  ajc
  * The size constant "256" which shows up everywhere as a buffer size has now
    been changed to SIZ.  And, SIZ has been defined now as 1024, not 256, because
@@ -2253,3 +2256,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 4842532cfa503a1b82d28c20e704536b236204ad..183d1544abd783e502e0ea9dbb071d327707e332 100644 (file)
@@ -122,13 +122,13 @@ void serv_gets(char *buf)
         */
        for (i = 0;; i++) {
                serv_read(&buf[i], 1);
-               if (buf[i] == '\n' || i == 255)
+               if (buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline.
         */
-       if (i == 255)
+       if (i == (SIZ-1))
                while (buf[i] != '\n')
                        serv_read(&buf[i], 1);
 
index e4d76c02b50c2f68379413d5ca332941fa7d2c52..f635a19985ca2b12bdf7e3292c5db74ad97316b4 100644 (file)
@@ -506,7 +506,7 @@ void cmd_mesg(char *mname)
                }
        cprintf("%d %s\n",LISTING_FOLLOWS,buf);
 
-       while (fgets(buf,255,mfp)!=NULL) {
+       while (fgets(buf, (SIZ-1), mfp)!=NULL) {
                buf[strlen(buf)-1] = 0;
                do_help_subst(buf);
                cprintf("%s\n",buf);
index a7a7e82c23445b7edff09c4428f8ad0d6294b66a..00039e5de49c9d449da76a0cbcb7b1772037d9c2 100644 (file)
@@ -138,13 +138,13 @@ int sock_gets(int sock, char *buf)
         */
        for (i = 0;; i++) {
                if (sock_read(sock, &buf[i], 1) < 0) return(-1);
-               if (buf[i] == '\n' || i == 255)
+               if (buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline.
         */
-       if (i == 255)
+       if (i == (SIZ-1))
                while (buf[i] != '\n')
                        if (sock_read(sock, &buf[i], 1) < 0) return(-1);
 
index 3a67eb77eff00991902fe841f57841fef638d30b..50cc2fe0b7d4b7addb6f9355b7c0539f38f5a16e 100644 (file)
@@ -1195,7 +1195,7 @@ FMTA:     while ((eof_flag == 0) && (strlen(buffer) < 126)) {
 
        if ( (!strncasecmp(buffer, "http://", 7))
           || (!strncasecmp(buffer, "ftp://", 6)) ) {
-               safestrncpy(urls[num_urls], buffer, 255);
+               safestrncpy(urls[num_urls], buffer, (SIZ-1));
                for (a=0; a<strlen(urls[num_urls]); ++a) {
                        b = urls[num_urls][a];
                        if ( (b==' ') || (b==')') || (b=='>') || (b==10)
index b49c6f1f2f5cf47074edd473486a32930fee8bb4..c8a3ab9d8053aba388c53b9810ac958922f0d66c 100644 (file)
@@ -239,13 +239,13 @@ void serv_gets(char *buf)
         */
        for (i = 0;; i++) {
                serv_read(&buf[i], 1);
-               if (buf[i] == '\n' || i == 255)
+               if (buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline.
         */
-       if (i == 255)
+       if (i == (SIZ-1))
                while (buf[i] != '\n')
                        serv_read(&buf[i], 1);
 
index 4b50a464ce6c86a9f36d91ad94d3149bbe878723..167e475dae9c40d2e4f7750181555f3c45e0972b 100644 (file)
@@ -708,7 +708,7 @@ void CtdlFreeMessage(struct CtdlMessage *msg)
 
        if (is_valid_message(msg) == 0) return;
 
-       for (i = 0; i < SIZ; ++i)
+       for (i = 0; i < 256; ++i)
                if (msg->cm_fields[i] != NULL) {
                        phree(msg->cm_fields[i]);
                }
@@ -969,7 +969,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
        strcpy(lnode, HUMANNODE);
        if (mode == MT_RFC822) {
                cprintf("X-UIDL: %ld%s", msg_num, nl);
-               for (i = 0; i < SIZ; ++i) {
+               for (i = 0; i < 256; ++i) {
                        if (TheMessage->cm_fields[i]) {
                                mptr = TheMessage->cm_fields[i];
 
index c11df8c4fed52be2e08089a61e1b2d6036106dcd..92710f021cdc82d1a9c92f4a6c4064d55d1dad25 100644 (file)
@@ -48,17 +48,17 @@ struct netnode *load_node(char *nodename)
        strcpy(newnn->nn_nodename, nodename);
        newnn->nn_first = NULL;
 
-       fgets(buf, 255, fp);
+       fgets(buf, (SIZ-1), fp);
        buf[strlen(buf)-1] = 0;
        strcpy(newnn->nn_spoolcmd, buf);
 
-       while (fgets(buf, 255, fp) != NULL) {
+       while (fgets(buf, (SIZ-1), fp) != NULL) {
                newrs = (struct roomshare *) malloc(sizeof(struct roomshare));
                newrs->next = newnn->nn_first;
                newnn->nn_first = newrs;
                buf[strlen(buf)-1] = 0;
                strcpy(newrs->rs_name, buf);
-               fgets(buf, 255, fp);
+               fgets(buf, (SIZ-1), fp);
                buf[strlen(buf)-1] = 0;
                newrs->rs_lastsent = atol(buf);
                }
@@ -127,7 +127,7 @@ void display_nodelist(void) {
                exit(errno);
                }
 
-       while (fgets(buf, 255, ls) != NULL) {
+       while (fgets(buf, (SIZ-1), ls) != NULL) {
                printf("%s", buf);
                }
 
@@ -209,10 +209,10 @@ void do_roomlist(char *NodeName)
                exit(3);
                }
 
-       fgets(buf, 255, fp);    /* skip past spool cmd */
-       while (fgets(buf, 255, fp) != NULL) {
+       fgets(buf, (SIZ-1), fp);        /* skip past spool cmd */
+       while (fgets(buf, (SIZ-1), fp) != NULL) {
                printf("%s", buf);
-               fgets(buf, 255, fp);    /* skip past last-sent pointer */
+               fgets(buf, (SIZ-1), fp); /* skip past last-sent pointer */
                }
 
        fclose(fp);
@@ -237,7 +237,7 @@ void show_spool_cmd(char *NodeName)
                exit(3);
                }
 
-       fgets(buf, 255, fp);
+       fgets(buf, (SIZ-1), fp);
        printf("%s", buf);
        fclose(fp);
        }
@@ -255,7 +255,7 @@ void set_spool_cmd(char *nodename, char *spoolcmd)
                exit(4);
                }
 
-       strncpy(nnptr->nn_spoolcmd, spoolcmd, 255);
+       strncpy(nnptr->nn_spoolcmd, spoolcmd, (SIZ-1));
        save_node(nnptr);
        }
 
index 3e276edc2bd42010752dc3b134a4ce9bb4e06e51..e69a2a9ebf01d18f6b8579dc00b5aa383eeec456 100644 (file)
@@ -977,7 +977,7 @@ void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
                        }
 
                fp=fopen(temp,"r");
-               while (fgets(cmd,255,fp)!=NULL) {
+               while (fgets(cmd,SIZ-1,fp)!=NULL) {
                        cmd[strlen(cmd)-1] = 0;
                        serv_puts(cmd);
                        }
index 061d0b44fab62cbd4c87e0f5b3c5799b2d98e04f..3a04baeaf8ef4dffe43cfa8a0933af117f98c4ec 100644 (file)
@@ -164,7 +164,7 @@ int main(int argc, char **argv)
                }
        } else if (buf[0] == '4') {
                do {
-                       if (fgets(buf, 255, stdin) == NULL)
+                       if (fgets(buf, sizeof buf, stdin) == NULL)
                                strcpy(buf, "000");
                        if (strlen(buf) > 0)
                                if (buf[strlen(buf) - 1] == '\n')
index 37543c89c60cb3f208b8ee6bb8127c83b8154bf6..f4599bec8b8f5158733f3c56c35b44e64a28260a 100644 (file)
@@ -106,7 +106,7 @@ void cmd_lbio(char *cmdbuf) {
        }
 
        cprintf("%d\n",LISTING_FOLLOWS);
-       while (fgets(buf,255,ls)!=NULL)
+       while (fgets(buf,sizeof buf,ls)!=NULL)
                if (getuserbynumber(&usbuf,atol(buf))==0)
                        cprintf("%s\n",usbuf.fullname);
        pclose(ls);
index c876ca218c630fe5c2756614af7660b5e3c89356..99284f6c739195e47a630e194edce4d10f86809a 100644 (file)
@@ -109,7 +109,7 @@ void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs)
                sprintf(buf,"cd %s; exec ls",dirs[a]);
                ls = (FILE *) popen(buf,"r");
                if (ls != NULL) {
-                       while(fgets(buf,255,ls)!=NULL) {
+                       while(fgets(buf,sizeof buf,ls)!=NULL) {
                                while (isspace(buf[strlen(buf)-1]))
                                        buf[strlen(buf)-1] = 0;
                                if (!strcasecmp(buf,searchfor)) {
index a50bb0818fe0f7a9d3a8c561f0439d536aafb425..107d40df57e174f8a79c204ba88ac2a693885252 100644 (file)
@@ -536,13 +536,13 @@ int client_gets(char *buf)
         */
        for (i = 0;;i++) {
                retval = client_read(&buf[i], 1);
-               if (retval != 1 || buf[i] == '\n' || i == 255)
+               if (retval != 1 || buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline.
         */
-       if (i == 255)
+       if (i == (SIZ-1))
                while (buf[i] != '\n' && retval == 1)
                        retval = client_read(&buf[i], 1);