r4407 - trunk/src/target/opkg/libopkg
thomas at docs.openmoko.org
thomas at docs.openmoko.org
Tue Apr 29 13:53:23 CEST 2008
Author: thomas
Date: 2008-04-29 13:53:22 +0200 (Tue, 29 Apr 2008)
New Revision: 4407
Modified:
trunk/src/target/opkg/libopkg/opkg.c
Log:
opkg: prevent segfault if option is not found
Modified: trunk/src/target/opkg/libopkg/opkg.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg.c 2008-04-29 01:40:56 UTC (rev 4406)
+++ trunk/src/target/opkg/libopkg/opkg.c 2008-04-29 11:53:22 UTC (rev 4407)
@@ -295,7 +295,7 @@
void
opkg_set_option (opkg_t *opkg, char *option, void *value)
{
- int i = 0;
+ int i = 0, found = 0;
opkg_option_t *options;
opkg_assert (opkg != NULL);
@@ -311,11 +311,18 @@
{
if (strcmp (options[i].name, option) == 0)
{
+ found = 1;
break;
}
i++;
}
+ if (!found)
+ {
+ /* XXX: Warning: Option not found */
+ return;
+ }
+
/* set the option */
switch (options[i].type)
{
More information about the commitlog
mailing list