In message <[EMAIL PROTECTED]> Kris Kennaway 
writes:
: I'll commit this tomorrow (just wanted to get in a 'first post!' :-)..

Please don't.  Please use a proper fix instead.

:       /* Have now read in the data. Next get the message to be printed. */
:       if (*argv) {
: -             strcpy(message, *argv);
: +             strncpy(message, *argv, MAXMSG);
:               while (*++argv) {
: -                     strcat(message, " ");
: -                     strcat(message, *argv);
: +                     strlcat(message, " ", MAXMSG);
: +                     strlcat(message, *argv, MAXMSG);

Can you precompute the length, malloc the buffer and go from there?
wouldn't that be better?

:               }
:               nchars = strlen(message);
:       } else {
:               fprintf(stderr,"Message: ");
: -             (void)fgets(message, sizeof(message), stdin);
: +             (void)fgets(message, MAXMSG, stdin);

This is bad style.  Don't make this change.

:               nchars = strlen(message);
:               message[nchars--] = '\0';       /* get rid of newline */
:       }

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to