Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jul 2001 21:41:12 +0200 (CEST)
From:      goran.lowkrantz@ismobile.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/29218: Missing pointer increment in wcsspn result in eternal loop
Message-ID:  <200107221941.f6MJfCD17465@skade.lule2.infologigruppen.se>

next in thread | raw e-mail | index | archive | help

>Number:         29218
>Category:       bin
>Synopsis:       Missing pointer increment in wcsspn result in eternal loop
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 25 06:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Goran Lowkrantz
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
isMobile AB
>Environment:
System: FreeBSD skade.lule2.infologigruppen.se 4.3-STABLE FreeBSD 4.3-STABLE #3: Fri Jul 20 22:45:53 CEST 2001 root@midgard.lule2.infologigruppen.se:/usr/src/sys/compile/SKADE i386

>Description:
In the libc function wcsspn, the search set pointer is not incremented. As a result, any call to this function results in an eternal loop.

>How-To-Repeat:
#include <cwchar>
#include <iostream>

int main(int argc, char* argv[])
{

        wchar_t * x = L"abcdefghijkabcdefghijk";

        size_t y = wcsspn(x, L"abcdf");
        cerr << y << endl;

        y = wcsspn(x, L"mno");
        cerr << y << endl;

        return 0;
}

>Fix:
--- wcsspn.c.orig       Sun Jul 22 21:33:35 2001
+++ wcsspn.c    Sun Jul 22 21:28:45 2001
@@ -50,6 +50,7 @@
                while (*q) {
                        if (*p == *q)
                                break;
+                       ++q;
                }
                if (!*q)
                        goto done;

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107221941.f6MJfCD17465>