Project

General

Profile

Bug #1722 ยป lighttpd-1.4.19-env_add.patch

Patch to fix env_add against lighttpd 1.4.19 - chris@arachsys.com, 2008-07-15 19:51

View differences:

src/mod_fastcgi.c
693 693

  
694 694
static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
695 695
	char *dst;
696
	size_t i;
696 697

  
697 698
	if (!key || !val) return -1;
698 699

  
......
701 702
	dst[key_len] = '=';
702 703
	/* add the \0 from the value */
703 704
	memcpy(dst + key_len + 1, val, val_len + 1);
705

  
706
	for (i = 0; i < env->used; i++)
707
		if (strlen(env->ptr[i]) >= key_len + 1 &&
708
		    memcmp(dst, env->ptr[i], key_len + 1) == 0) {
709
			free(env->ptr[i]);
710
			env->ptr[i] = dst;
711
			return 0;
712
		}
704 713

  
705 714
	if (env->size == 0) {
706 715
		env->size = 16;
src/mod_scgi.c
583 583

  
584 584
static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
585 585
	char *dst;
586
	size_t i;
586 587

  
587 588
	if (!key || !val) return -1;
588 589

  
......
591 592
	dst[key_len] = '=';
592 593
	/* add the \0 from the value */
593 594
	memcpy(dst + key_len + 1, val, val_len + 1);
595

  
596
	for (i = 0; i < env->used; i++)
597
		if (strlen(env->ptr[i]) >= key_len + 1 &&
598
		    memcmp(dst, env->ptr[i], key_len + 1) == 0) {
599
			free(env->ptr[i]);
600
			env->ptr[i] = dst;
601
			return 0;
602
		}
594 603

  
595 604
	if (env->size == 0) {
596 605
		env->size = 16;
    (1-1/1)