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

(-)imapd.c.orig (-7 / +17 lines)
Lines 284-289 Link Here
284
    int r;
284
    int r;
285
285
286
    if (!ulen) ulen = strlen(user);
286
    if (!ulen) ulen = strlen(user);
287
    if (ulen > MAX_MAILBOX_NAME)
288
        ulen = MAX_MAILBOX_NAME;
287
289
288
    if (config_getswitch(IMAPOPT_IMAPMAGICPLUS)) {
290
    if (config_getswitch(IMAPOPT_IMAPMAGICPLUS)) {
289
	/* make a working copy of the auth[z]id */
291
	/* make a working copy of the auth[z]id */
Lines 345-350 Link Here
345
347
346
	/* make a working copy of the authzid */
348
	/* make a working copy of the authzid */
347
	if (!rlen) rlen = strlen(requested_user);
349
	if (!rlen) rlen = strlen(requested_user);
350
	if (rlen > MAX_MAILBOX_NAME)
351
	    rlen = MAX_MAILBOX_NAME;
352
348
	memcpy(userbuf, requested_user, rlen);
353
	memcpy(userbuf, requested_user, rlen);
349
	userbuf[rlen] = '\0';
354
	userbuf[rlen] = '\0';
350
	requested_user = userbuf;
355
	requested_user = userbuf;
Lines 2349-2358 Link Here
2349
    while (!r && c == ' ') {
2354
    while (!r && c == ' ') {
2350
	/* Grow the stage array, if necessary */
2355
	/* Grow the stage array, if necessary */
2351
	if (numstage == numalloc) {
2356
	if (numstage == numalloc) {
2357
	    if (numalloc > INT_MAX/(2*sizeof(struct appendstage *)))
2358
		goto done;
2352
	    numalloc *= 2;
2359
	    numalloc *= 2;
2353
	    stage = xrealloc(stage, numalloc * sizeof(struct appendstage *));
2360
	    stage = xrealloc(stage, numalloc * sizeof(struct appendstage *));
2354
	}
2361
	}
2355
	curstage = stage[numstage++] = xzmalloc(sizeof(struct appendstage));
2362
	curstage = stage[numstage] = xzmalloc(sizeof(struct appendstage));
2363
	++numstage;
2356
2364
2357
	/* Parse flags */
2365
	/* Parse flags */
2358
	c = getword(imapd_in, &arg);
2366
	c = getword(imapd_in, &arg);
Lines 2372-2378 Link Here
2372
			(char **) xrealloc((char *) curstage->flag, 
2380
			(char **) xrealloc((char *) curstage->flag, 
2373
					   curstage->flagalloc * sizeof(char *));
2381
					   curstage->flagalloc * sizeof(char *));
2374
		}
2382
		}
2375
		curstage->flag[curstage->nflags++] = xstrdup(arg.s);
2383
		curstage->flag[curstage->nflags] = xstrdup(arg.s);
2384
		++curstage->nflags;
2376
	    } while (c == ' ');
2385
	    } while (c == ' ');
2377
	    if (c != ')') {
2386
	    if (c != ')') {
2378
		parseerr = 
2387
		parseerr = 
Lines 2770-2779 Link Here
2770
		int binsize = 0;
2779
		int binsize = 0;
2771
2780
2772
		p = section = fetchatt.s + 7;
2781
		p = section = fetchatt.s + 7;
2773
		if (*p == 'P') {
2782
		if (!strncmp(p, "PEEK[", 5)) {
2774
		    p = section += 5;
2783
		    p = section += 5;
2775
		}
2784
		}
2776
		else if (*p == 'S') {
2785
		else if (!strncmp(p, "SIZE[", 5)) {
2777
		    p = section += 5;
2786
		    p = section += 5;
2778
		    binsize = 1;
2787
		    binsize = 1;
2779
		}
2788
		}
Lines 2813-2819 Link Here
2813
	    else if (!strncmp(fetchatt.s, "BODY[", 5) ||
2822
	    else if (!strncmp(fetchatt.s, "BODY[", 5) ||
2814
		     !strncmp(fetchatt.s, "BODY.PEEK[", 10)) {
2823
		     !strncmp(fetchatt.s, "BODY.PEEK[", 10)) {
2815
		p = section = fetchatt.s + 5;
2824
		p = section = fetchatt.s + 5;
2816
		if (*p == 'P') {
2825
		if (!strncmp(p, "PEEK[", 5)) {
2817
		    p = section += 5;
2826
		    p = section += 5;
2818
		}
2827
		}
2819
		else {
2828
		else {
Lines 3154-3160 Link Here
3154
    else if (!strncmp(data, "body[", 5) ||
3163
    else if (!strncmp(data, "body[", 5) ||
3155
	     !strncmp(data, "body.peek[", 10)) {
3164
	     !strncmp(data, "body.peek[", 10)) {
3156
	p = section = data + 5;
3165
	p = section = data + 5;
3157
	if (*p == 'p') {
3166
	if (!strncmp(p, "peek[", 5)) {
3158
	    p = section += 5;
3167
	    p = section += 5;
3159
	}
3168
	}
3160
	else {
3169
	else {
Lines 3314-3320 Link Here
3314
		flag = (char **)xrealloc((char *)flag,
3323
		flag = (char **)xrealloc((char *)flag,
3315
					 flagalloc*sizeof(char *));
3324
					 flagalloc*sizeof(char *));
3316
	    }
3325
	    }
3317
	    flag[nflags++] = xstrdup(flagname.s);
3326
	    flag[nflags] = xstrdup(flagname.s);
3327
	    ++nflags;
3318
	}
3328
	}
3319
3329
3320
	flagsparsed++;
3330
	flagsparsed++;

Return to bug 63201