From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22322 invoked by alias); 7 Jul 2008 18:49:23 -0000 Received: (qmail 21823 invoked by uid 48); 7 Jul 2008 18:48:41 -0000 Date: Mon, 07 Jul 2008 18:49:00 -0000 Message-ID: <20080707184841.21822.qmail@sourceware.org> From: "lists at roberthogan dot net" To: glibc-bugs-regex@sources.redhat.com In-Reply-To: <20080704200314.6722.lists@roberthogan.net> References: <20080704200314.6722.lists@roberthogan.net> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug regex/6722] sscanf bug when parsing lines from /proc/net/tcp X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-regex-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-regex-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00002.txt.bz2 ------- Additional Comments From lists at roberthogan dot net 2008-07-07 18:48 ------- Apologies, I should have provided the full test case. This should recreate the problem. locaddr and remaddr are 32-bit ints. #include # include int main() { FILE *f; u_int32_t locaddr, remaddr, uid, inode = 0; u_int16_t locport, remport; static char big_str[151]; f = fopen("/proc/net/tcp", "r"); fgets(big_str,151,f); while (fgets(big_str, 152, f) != NULL) { sscanf(big_str, "%*d: %8x:%4x %8x:%4x %*2x %*8x:%*8x %*2x: %*8x%*8x %d %*d %u \n", &locaddr, (unsigned int *) &locport, &remaddr, (unsigned int *) &remport,&uid, &inode); printf("%s", big_str); printf("%d %x %x %x %x %x\n",locaddr, locport, remaddr, remport, uid, inode); } } -- http://sourceware.org/bugzilla/show_bug.cgi?id=6722 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.