--- /dev/null
+diff -uNr libsmi-0.4.8-orig/lib/smi.c libsmi-0.4.8/lib/smi.c
+--- libsmi-0.4.8-orig/lib/smi.c 2008-04-18 12:42:50.000000000 +0200
++++ libsmi-0.4.8/lib/smi.c 2010-03-23 10:51:12.373123639 +0100
+@@ -11,6 +11,7 @@
+ * @(#) $Id: smi.c 8071 2008-04-17 11:14:46Z schoenw $
+ */
+
++#define _GNU_SOURCE
+ #include <config.h>
+
+ #include <stdlib.h>
--- /dev/null
+diff -uNr libsmi-0.4.8-orig/lib/parser-sming.y libsmi-0.4.8/lib/parser-sming.y
+--- libsmi-0.4.8-orig/lib/parser-sming.y 2008-04-18 12:42:50.000000000 +0200
++++ libsmi-0.4.8/lib/parser-sming.y 2010-03-23 10:44:11.777122974 +0100
+@@ -2161,8 +2161,8 @@
+ classPtr, thisParserPtr);
+ setAttributeParentType($$, smiHandle->typeBitsPtr);
+ if ($1) {
+- setAttributeList($$, $1);
+- for (p = $1; p; p = p->nextPtr)
++ setAttributeList($$, (void *)$1);
++ for (p = (void *)$1; p; p = (void *)p->nextPtr)
+ ((NamedNumber *)(p->ptr))->typePtr = (Type*)$$;
+ }
+
--- /dev/null
+Index: lib/smi.c
+===================================================================
+--- lib/smi.c (revision 29144)
++++ lib/smi.c (working copy)
+@@ -1793,10 +1793,15 @@
+ }
+
+ if (isdigit((int)node2[0])) {
+- for (oidlen = 0, p = strtok(node2, ". "); p;
++ for (oidlen = 0, p = strtok(node2, ". ");
++ p && oidlen < sizeof(oid)/sizeof(oid[0]);
+ oidlen++, p = strtok(NULL, ". ")) {
+ oid[oidlen] = strtoul(p, NULL, 0);
+ }
++ if (p) {
++ /* the numeric OID is too long */
++ return NULL;
++ }
+ nodePtr = getNode(oidlen, oid);
+ if (nodePtr) {
+ if (modulePtr) {
--- /dev/null
+Name: libsmi
+Version: 0.4.8
+Release: 2
+License: MIT
+Summary: A Library to Access SMI MIB Information
+Url: http://www.ibr.cs.tu-bs.de/projects/libsmi
+Group: System/Libraries
+Source: %{name}-%{version}.tar.bz2
+Patch0: libsmi-0.4.8-parser.patch
+Patch1: libsmi-0.4.8-gnu-source.patch
+Patch2: libsmi-CVE-2010-2891.patch
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: libtool
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+The purpose of libsmi is to
+
+* Give network management applications a concise programmer-friendly
+ interface to access MIB module information
+
+* Separate the knowledge on SMI from the main parts of management
+ applications
+
+* Allow addition of new kinds of MIB repositories without the need to
+adapt applications that make use of libsmi
+
+%package devel
+License: MIT
+Summary: Libsmi Header Files And Static Libraries
+Group: Development/Libraries/C and C++
+Requires: %{name} = %{version}
+Requires: glibc-devel
+
+%description devel
+This package contains the header files and static libraries of package
+libsmi.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2
+
+%build
+autoreconf --force --install
+%configure --disable-static --with-pic --enable-smi \
+ --enable-sming \
+ --with-mibdir=%{_datadir}/mibs
+
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+rm -f %{buildroot}%{_libdir}/*.la
+
+%post -n libsmi -p /sbin/ldconfig
+
+%postun -n libsmi -p /sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+%doc COPYING doc/*.txt
+%doc %{_mandir}/man?/*
+%{_bindir}/*
+%{_datadir}/mibs
+%{_datadir}/pibs
+%{_libdir}/libsmi.so.*
+
+
+%files devel
+%defattr(-, root, root)
+%{_includedir}/*
+%{_libdir}/libsmi.so
+%{_libdir}/pkgconfig/libsmi.pc
+%{_datadir}/aclocal/libsmi.m4
+
+%changelog