readdir.c (23659) | readdir.c (33665) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 55 } 56 if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) { 57 dirp->dd_size = getdirentries(dirp->dd_fd, 58 dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); 59 if (dirp->dd_size <= 0) 60 return (NULL); 61 } 62 dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 55 } 56 if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) { 57 dirp->dd_size = getdirentries(dirp->dd_fd, 58 dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); 59 if (dirp->dd_size <= 0) 60 return (NULL); 61 } 62 dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); |
63 if ((int)dp & 03) /* bogus pointer check */ | 63 if ((long)dp & 03L) /* bogus pointer check */ |
64 return (NULL); 65 if (dp->d_reclen <= 0 || 66 dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) 67 return (NULL); 68 dirp->dd_loc += dp->d_reclen; 69 if (dp->d_ino == 0) 70 continue; 71 if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW)) 72 continue; 73 return (dp); 74 } 75} | 64 return (NULL); 65 if (dp->d_reclen <= 0 || 66 dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) 67 return (NULL); 68 dirp->dd_loc += dp->d_reclen; 69 if (dp->d_ino == 0) 70 continue; 71 if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW)) 72 continue; 73 return (dp); 74 } 75} |