View | Details | Raw Unified | Return to bug 38671
Collapse All | Expand All

(-)cp.c (+10 lines)
Lines 172-177 Link Here
172
172
173
	/* Save the target base in "to". */
173
	/* Save the target base in "to". */
174
	target = argv[--argc];
174
	target = argv[--argc];
175
	if (strlen(target) > MAXPATHLEN)
176
		errx(1, "%s: name too long", target);
175
	if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
177
	if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
176
		errx(1, "%s: name too long", target);
178
		errx(1, "%s: name too long", target);
177
	to.p_end = to.p_path + strlen(to.p_path);
179
	to.p_end = to.p_path + strlen(to.p_path);
Lines 290-295 Link Here
290
                 * source name to the target name.
292
                 * source name to the target name.
291
                 */
293
                 */
292
		if (type != FILE_TO_FILE) {
294
		if (type != FILE_TO_FILE) {
295
			if ((curr->fts_namelen +
296
			    to.target_end - to.p_path + 1) > MAXPATHLEN) {
297
				warnx("%s/%s: name too long (not copied)",
298
				    to.p_path, curr->fts_name);
299
				rval = 1;
300
				continue;
301
			}
302
293
			/*
303
			/*
294
			 * Need to remember the roots of traversals to create
304
			 * Need to remember the roots of traversals to create
295
			 * correct pathnames.  If there's a directory being
305
			 * correct pathnames.  If there's a directory being

Return to bug 38671