summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2014-11-29 15:53:24 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-29 15:53:24 +0900
commita15ec56e4f947e098b7d841d8bc98c66717b4134 (patch)
treea504a075c1b7c7c56dc73423f1ac3941e2fccef0
parentac7d7c9cbed92f21aa4a7555c4fee701227559a8 (diff)
Check return value of udev_device_get_sysattr_value(); before using atoi();
Summary: udev_device_get_sysattr_value(); could return NULL, and using atoi(); with NULL make system crash Test Plan: It is hard to make a case to retun NULL. I got this from aging test of a product. Reviewers: cedric, raster, seoz, woohyun, Hermet, jaehwan Subscribers: cedric, seoz Differential Revision: https://phab.enlightenment.org/D1687
-rw-r--r--src/lib/eeze/eeze_net.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/eeze/eeze_net.c b/src/lib/eeze/eeze_net.c
index 044c899..8c6b386 100644
--- a/src/lib/eeze/eeze_net.c
+++ b/src/lib/eeze/eeze_net.c
@@ -84,6 +84,15 @@ eeze_net_new(const char *name)
84 net->syspath = syspath; 84 net->syspath = syspath;
85 net->name = eina_stringshare_add(name); 85 net->name = eina_stringshare_add(name);
86 idx = udev_device_get_sysattr_value(net->device, "ifindex"); 86 idx = udev_device_get_sysattr_value(net->device, "ifindex");
87 if (!idx)
88 {
89 udev_device_unref(net->device);
90 eina_stringshare_del(net->syspath);
91 eina_stringshare_del(net->name);
92
93 free(net);
94 return NULL;
95 }
87 net->index = atoi(idx); 96 net->index = atoi(idx);
88 eina_hash_add(eeze_nets, name, net); 97 eina_hash_add(eeze_nets, name, net);
89 udev_enumerate_unref(en); 98 udev_enumerate_unref(en);