diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-12-25 22:47:03 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-12-25 22:47:03 +0100 |
commit | b8215e9e6754b5bc468552c91cecdd74563fa331 (patch) | |
tree | 852329a32b4641559fbfd91b1ace0bfcd383f1c8 /ftpfs/ftpfs.c | |
parent | f7902eddf30fd6aa62a29f2c9425519f6b01ea66 (diff) |
Fix NULL dereference
* ftpfs/ftpfs.c (parse_startup_opt): Do not derefence sep when it is NULL.
Diffstat (limited to 'ftpfs/ftpfs.c')
-rw-r--r-- | ftpfs/ftpfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ftpfs/ftpfs.c b/ftpfs/ftpfs.c index 09c072d1..393cc5ba 100644 --- a/ftpfs/ftpfs.c +++ b/ftpfs/ftpfs.c @@ -272,14 +272,16 @@ parse_startup_opt (int key, char *arg, struct argp_state *state) ftpfs_remote_root = sep + 1; /* Lookup the ftp server (the part before the `:'). */ - *sep = '\0'; + if (sep) + *sep = '\0'; err = lookup_server (ftpfs_remote_fs, &ftpfs_ftp_params, &h_err); if (err == EINVAL) argp_failure (state, 10, 0, "%s: %s", ftpfs_remote_fs, hstrerror (h_err)); else if (err) argp_failure (state, 11, err, "%s", ftpfs_remote_fs); - *sep = ':'; + if (sep) + *sep = ':'; } case ARGP_KEY_INIT: |