Changeset 636 in openpam


Ignore:
Timestamp:
Mar 3, 2013, 11:27:35 PM (8 years ago)
Author:
Dag-Erling Smørgrav
Message:

Always use openpam_straddch(3) to bootstrap the string, even if we
have nothing to add to it. This simplifies the code and fixes a bug
introduced in r553 where the first character in the string would
always be set to '\0', instead of only when bootstrapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_readword.c

    r619 r636  
    8686                        quote = ch;
    8787                        /* edge case: empty quoted string */
    88                         if (word == NULL && (word = malloc(1)) == NULL) {
    89                                 openpam_log(PAM_LOG_ERROR, "malloc(): %m");
    90                                 errno = ENOMEM;
     88                        if (openpam_straddch(&word, &size, &len, 0) != 0)
    9189                                return (NULL);
    92                         }
    93                         *word = '\0';
    94                         size = 1;
    9590                } else if (ch == quote && !escape) {
    9691                        /* end quote */
Note: See TracChangeset for help on using the changeset viewer.