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

(-)sbin/ping/ping.c (-2 / +2 lines)
Lines 337-343 Link Here
337
			break;
337
			break;
338
		case 'G': /* Maximum packet size for ping sweep */
338
		case 'G': /* Maximum packet size for ping sweep */
339
			ltmp = strtol(optarg, &ep, 0);
339
			ltmp = strtol(optarg, &ep, 0);
340
			if (*ep || ep == optarg || ltmp <= 0)
340
			if (*ep || ep == optarg || ltmp > (long)INT_MAX || ltmp <= 0)
341
				errx(EX_USAGE, "invalid packet size: `%s'",
341
				errx(EX_USAGE, "invalid packet size: `%s'",
342
				    optarg);
342
				    optarg);
343
			if (uid != 0 && ltmp > DEFDATALEN) {
343
			if (uid != 0 && ltmp > DEFDATALEN) {
Lines 351-357 Link Here
351
			break;
351
			break;
352
		case 'g': /* Minimum packet size for ping sweep */
352
		case 'g': /* Minimum packet size for ping sweep */
353
			ltmp = strtol(optarg, &ep, 0);
353
			ltmp = strtol(optarg, &ep, 0);
354
			if (*ep || ep == optarg || ltmp <= 0)
354
			if (*ep || ep == optarg || ltmp > (long)INT_MAX || ltmp <= 0)
355
				errx(EX_USAGE, "invalid packet size: `%s'",
355
				errx(EX_USAGE, "invalid packet size: `%s'",
356
				    optarg);
356
				    optarg);
357
			if (uid != 0 && ltmp > DEFDATALEN) {
357
			if (uid != 0 && ltmp > DEFDATALEN) {

Return to bug 239977