Package: dietlibc-dev
Version: 0.32-5
Severity: normal

memchr("a", '\0', 1) should return NULL.

Sample test:

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

void *mymemchr(const void *p, int ch, unsigned sz)
{
    const char *s = p;
    while(sz--){
        if(*s == ch)
            return s;
        ++s;
    }
    return 0;
}

void m0(const char *s){
    int len = strlen(s);
    int i;
    for(i = 0; i <= len+1; i++){
        char *lib = memchr(s, '\0', i);
        char *xxx = mymemchr(s, '\0', i);
        if(lib != xxx){
            printf("s=\"%s\" i=%d --> xxx=%p, lib=%p\n", s, i, xxx, lib);
            exit(1);
        }
    }
} 
int main()
{
    m0("a");
    return 0;
}


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/1 CPU core)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

dietlibc-dev depends on no packages.

Versions of packages dietlibc-dev recommends:
pn  dietlibc                      <none>     (no description available)

Versions of packages dietlibc-dev suggests:
pn  dietlibc-doc                  <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to